RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1993081 - Regression: /CoreOS/shadow-utils/Regression/bz955769-useradd-not-assigning-correct-SELinux-user-to
Summary: Regression: /CoreOS/shadow-utils/Regression/bz955769-useradd-not-assigning-co...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: shadow-utils
Version: 9.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: beta
: ---
Assignee: Iker Pedrosa
QA Contact: Anuj Borah
URL:
Whiteboard: sync-to-jira review
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-12 10:43 UTC by Iker Pedrosa
Modified: 2022-05-17 16:31 UTC (History)
5 users (show)

Fixed In Version: shadow-utils-4.9-3.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 15:59:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-93364 0 None None None 2021-08-12 11:05:03 UTC
Red Hat Issue Tracker SSSD-3757 0 None None None 2021-10-06 10:07:44 UTC
Red Hat Product Errata RHBA-2022:3997 0 None None None 2022-05-17 15:59:32 UTC

Description Iker Pedrosa 2021-08-12 10:43:47 UTC
Description of problem:
Regression of "/CoreOS/shadow-utils/Regression/bz955769-useradd-not-assigning-correct-SELinux-user-to" when ported upstream release 4.9.

Version-Release number of selected component (if applicable):
shadow-utils-4.9-1.el9

How reproducible:
Execute the test

Additional information:
http://artifacts.osci.redhat.com/baseos-ci/brew-build/38/91/47/38914777/https___baseos-jenkins.rhev-ci-vms.eng.rdu2.redhat.com-ci-artemis/14789/tmpofdDAW.01/recipes/1/tasks/16/results/1628756315/logs/resultoutputfile.log

Comment 7 Petr Lautrbach 2021-10-07 12:38:14 UTC
set_selinux_file_context() doesn't close selabel_hnd [1]. It means that
old file_contexts.* files are still mapped and used for selabel_lookup
even though there are new versions on the filesystem.

Simply adding selabel_close() to the end of set_selinux_file_context()
would probably have some performance impact so I'd add a new
function to selinux.c which would expose static void cleanup(void) to
other modules and call this function after a new selinux user mapping is added.

[1] https://github.com/shadow-maint/shadow/blob/master/lib/selinux.c#L76

e.g.


diff --git a/lib/prototypes.h b/lib/prototypes.h
index 688ad012ad00..d2b928f986bd 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -401,6 +401,7 @@ extern /*@observer@*/const char *crypt_make_salt (/*@null@*//*@observer@*/const
 /* selinux.c */
 #ifdef WITH_SELINUX
 extern int set_selinux_file_context (const char *dst_name, mode_t mode);
+extern void reset_selinux_handle ();
 extern int reset_selinux_file_context (void);
 extern int check_selinux_permit (const char *perm_name);
 #endif
diff --git a/lib/selinux.c b/lib/selinux.c
index c83545f99a4d..d78942dc2472 100644
--- a/lib/selinux.c
+++ b/lib/selinux.c
@@ -50,6 +50,10 @@ static void cleanup(void)
        }
 }
 
+void reset_selinux_handle () {
+       cleanup();
+}
+
 /*
  * set_selinux_file_context - Set the security context before any file or
  *                            directory creation.
diff --git a/src/useradd.c b/src/useradd.c
index 21da51b576f9..a4bf337cc42c 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -2587,6 +2587,7 @@ int main (int argc, char **argv)
 #endif                         /* WITH_AUDIT */
                        fail_exit (E_SE_UPDATE);
                }
+               reset_selinux_handle();
        }
 #endif                         /* WITH_SELINUX */

Comment 8 Iker Pedrosa 2021-11-12 15:50:11 UTC
@aborah can you provide qa_ack? In order to verify this bugzilla you only need to execute the automated test already present in Regression/bz955769-useradd-not-assigning-correct-SELinux-user-to

Comment 13 errata-xmlrpc 2022-05-17 15:59:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: shadow-utils), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3997


Note You need to log in before you can comment on or make changes to this bug.