Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2053413

Summary: /var/lib/kpatch directory is not labeled correctly after remove kpatch-patch package and reinstall
Product: Red Hat Enterprise Linux 9 Reporter: zhijwang <zhijwang>
Component: kpatchAssignee: Yannick Cote <ycote>
kpatch sub component: kpatch-utility QA Contact: zhijwang <zhijwang>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: bhu, dbohanno, joe.lawrence, kpatch-maint, rhandlin, ycote
Version: 9.0Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kpatch-0.9.4-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2065609 (view as bug list) Environment:
Last Closed: 2022-11-15 11:21:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2065609    

Description zhijwang 2022-02-11 09:05:20 UTC
Description of problem:
/var/lib/kpatch directory is not labeled correctly after remove kpatch-patch package and reinstall

Version-Release number of selected component (if applicable):
kpatch-0.9.4-2.el9
kpatch-patch-5_14_0-42-0-1.test.el9.x86_64(Just a example, many of kpatch-patch can be used for reproducing) 

How reproducible:
always

Steps to Reproduce:
1. Install the kpatch-patch package
2. Unload the kaptch-patch, and remove the kpatch-patch package by command "dnf -y remove kpatch-patch-xxx"
3. Install the kpatch-patch packages again. Issue will be reproduced in this step.

Actual results:
Install the kpatch-patch package:
[root@kvm-03-guest23 ~]# dnf -y install kpatch-patch 
[root@kvm-03-guest23 ~]# ls -dZ /var/lib/kpatch/
system_u:object_r:kpatch_var_lib_t:s0 /var/lib/kpatch/

3. Remove the kpatch-patch and reinstall:
[root@kvm-03-guest23 ~]# kpatch force unload --all 
disabling patch module: kpatch_5_14_0_42_0_1_test
waiting (up to 15 seconds) for patch transition to complete...
transition complete (2 seconds)
unloading patch module: kpatch_5_14_0_42_0_1_test
[root@kvm-03-guest23 ~]# dnf -y remove kpatch-patch 

[root@kvm-03-guest23 ~]# ls -dZ /var/lib/kpatch
ls: cannot access '/var/lib/kpatch': No such file or directory

[root@kvm-03-guest23 ~]# dnf -y install kpatch-patch 
...snip...
[root@kvm-03-guest23 ~]# ls -dZ /var/lib/kpatch/
unconfined_u:object_r:var_lib_t:s0 /var/lib/kpatch/                   <-----------issue reproduced.
[root@kvm-03-guest23 ~]# restorecon -Rv /var/lib/kpatch/
Relabeled /var/lib/kpatch from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:kpatch_var_lib_t:s0
Relabeled /var/lib/kpatch/5.14.0-42.el9.x86_64 from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:kpatch_var_lib_t:s0
Relabeled /var/lib/kpatch/5.14.0-42.el9.x86_64/kpatch-5_14_0-42-0-1_test.ko from unconfined_u:object_r:modules_object_t:s0 to unconfined_u:object_r:kpatch_var_lib_t:s0


Expected results:
The folder /var/lib/kpatch/ is labeled correctly, after re-installing kpatch-patch package. 

Additional info:

Comment 7 errata-xmlrpc 2022-11-15 11:21:11 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 (kpatch bug fix and enhancement update), 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:8363