Bug 1516514 (CVE-2017-1000405)

Summary: CVE-2017-1000405 kernel: pmd can become dirty without going through a COW cycle
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: airlied, ajax, aquini, bhu, blc, bskeggs, cperry, crecklin, dhoward, ewk, fhrbata, hdegoede, hkrzesin, hwkernel-mgr, iboverma, ichavero, itamar, jarodwilson, jeremy, jforbes, jglisse, jkacur, john.j5live, jonathan, josef, jross, jwboyer, kent, kernel-maint, kernel-mgr, labbott, lgoncalv, linville, matt, mchehab, mcressma, mjg59, mlangsdo, mvermaes, nmurray, plougher, pmatouse, rt-maint, rvrbovsk, security-response-team, steved, williams, wmealing
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the patches used to fix the 'dirtycow' vulnerability (CVE-2016-5195). An attacker, able to run local code, can exploit a race condition in transparent huge pages to modify usually read-only huge pages.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 03:31:49 UTC Type: ---
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: 1517816, 1518490, 1518491, 1518492, 1518493, 1518494, 1518495, 1518611, 1518612, 1519115    
Bug Blocks: 1516515    

Description Andrej Nemec 2017-11-22 19:34:42 UTC
A flaw was found in the patches used to fix the 'dirtycow' vulnerability CVE-2016-5195).  The touch_pmd() function can be accessed by get_user_pages(). In this case, the pmd will become dirty without going through the Copy On Write cycle. 

In the simplest example, a large page that is read-only can be modified, including page 0 of a processes virtual address space.

Upstream patch:
 https://github.com/torvalds/linux/commit/a8f97366452ed491d13cf1e44241bc0b5740b1f0


Vulnerability announcement: 
http://www.openwall.com/lists/oss-security/2017/11/30/1

Comment 1 Andrej Nemec 2017-11-22 19:34:54 UTC
Acknowledgments:

Name: Eylon Ben Yaakov, Daniel Shapiro

Comment 6 Wade Mealing 2017-11-29 05:25:09 UTC
Statement:

From the initial flaw description released, this issue does not affect the Linux kernel packages as shipped with Red Hat Enterprise Linux 5, 6, 7 and Red Hat Enterprise MRG 2.  They do not contain the upstream commit (8310d48b125d19fcd9521d83b8293e63eb1646aa) which allows the race condition.

This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 7 for ARM and Red Hat Enterprise Linux for Power LE.

Future Linux kernel updates for the respective releases may address this issue.

For further information please refer to the vulnerability article in the Customer Portal: https://access.redhat.com/security/vulnerabilities/3253921

Comment 7 Wade Mealing 2017-11-29 05:43:58 UTC
What is Red Hat Enterprise Linux 7 for ARM,
        Red Hat Enterprise Linux for Power LE,
        and kernel-alt:

The kernel-alt package as shipped with Red Hat Enterprise Linux 7 for ARM and Red Hat Enterprise Linux for Power LE is an updated kernel intended to support new architectures not available at the time of Red Hat Enterprise Linux 7 original shipping. The new kernel version provided by the kernel-alt packages is based on upstream version 4.11 . The offering is distributed with other updated packages but most of the userspace is the standard Red Hat Enterprise Linux 7 Server RPMs.

For more information please refer to:

https://access.redhat.com/articles/3158541
https://access.redhat.com/articles/3158511

Comment 8 Wade Mealing 2017-11-29 07:28:32 UTC
Mitigation:

Disabling the use of zero page:


It is possible to prevent the zero page from being mapped as a huge page, by modifying a configuration tunable in the /sys directory as shown below.  This prevents the flaw from being exercised in this method.

#  echo 0 > /sys/kernel/mm/transparent_hugepage/use_zero_page


Disabling huge pages:

It is possible to mitigate this flaw by disabling hugepages on a system.  Some user applications may require hugepages to be performant, and may suffer a performance penalty when running without hugepages.

Red Hat has existing solutions created instructing how to disable transparent

How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7
https://access.redhat.com/solutions/1320153

If your application may require transparent huge pages, please consult your software vendor to confirm.

Comment 11 Wade Mealing 2017-11-30 07:31:49 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1519115]

Comment 12 Andrej Nemec 2017-11-30 09:55:03 UTC
Public via:

http://www.openwall.com/lists/oss-security/2017/11/30/1

Comment 17 errata-xmlrpc 2018-01-25 11:03:25 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:0180 https://access.redhat.com/errata/RHSA-2018:0180