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 1958742

Summary: RHEL9: fix for "CoW after fork()" aka "vmsplice child -> parent attack" aka "GUP after fork()" bug
Product: Red Hat Enterprise Linux 9 Reporter: Andrea Arcangeli <aarcange>
Component: kernelAssignee: Andrea Arcangeli <aarcange>
kernel sub component: Memory Management QA Contact: Li Wang <liwan>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: aarcange, aquini, cye, ddutile, hkrzesin, knoel, mm-maint, peterx
Version: 9.0Keywords: Triaged
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: 9.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-5.14.0-43.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:38:18 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:

Description Andrea Arcangeli 2021-05-10 04:41:34 UTC
Description of two problems (first is a longstanding security issue that is easily reproducible since vmsplice was introduced, the second is an user ABI break vs RHEL8 and all kernels before commit 09854ba94c6aad7886996bfbee2530b3d8a7f4f4):

1) the child can read private memory of the parent process misusing get_user_pages (easy to reproduce with vmsplice as vector)

2) wrprotecting any pinned page no matter if short term or FOLL_LONGTERM or FOLL_PIN or FOLL_GET, may result in silent user data corruption. It has become a userland bug to wrprotect any page that may be pinned with mprotect(), clear_refs or any other MM code that has the capability of wrprotecting memory.

How reproducible: for 1) I modified the original testcase posted by Jann Horn on 27 May 2020 to show it still reproduces the security issue upstream.

Steps to Reproduce defect 1):

$ wget https://raw.githubusercontent.com/aagit/kernel-testcases-for-v5.11/main/vmsplice-v5.11.c
$ gcc vmsplice-v5.11.c -o vmsplice-v5.11 -O2
$ ./vmsplice-v5.11

Actual results: read string from child: THIS IS SECRET

Expected results: read string from child: BORING DATA

Steps to Reproduce defect 2):

$ wget https://raw.githubusercontent.com/aagit/kernel-testcases-for-v5.11/main/page_count_do_wp_page.c
$ gcc -o page_count_do_wp_page page_count_do_wp_page.c -O2 -lpthread
$ ./page_count_do_wp_page /tmp/whatever

Actual results: random memory corruption (not happening in RHEL8 or any kernel before 09854ba94c6aad7886996bfbee2530b3d8a7f4f4 broke the user ABI)

Expected results: same behavior as RHEL8, no output from this testcase, no user ABI break

Comment 25 errata-xmlrpc 2022-05-17 15:38:18 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: kernel), 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:3907