From 52ecac467c4313596b9d38c71e41dbb9ab9c7822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Erata?= Date: Mon, 25 Jan 2016 16:27:30 +0200 Subject: [PATCH] add CVE patch.. --- ...sable-forced-PORTS_IMPL-for-AHCI-1.3.patch | 42 ++++++++++ ...ing-ref-leak-in-join_session_keyring.patch | 82 +++++++++++++++++++ kernel/kernel/files/patches/mageia/series | 6 ++ kernel/kernel/pspec.xml | 10 ++- 4 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 kernel/kernel/files/patches/mageia/ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch create mode 100644 kernel/kernel/files/patches/mageia/keys-fix-keyring-ref-leak-in-join_session_keyring.patch diff --git a/kernel/kernel/files/patches/mageia/ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch b/kernel/kernel/files/patches/mageia/ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch new file mode 100644 index 00000000..266ac607 --- /dev/null +++ b/kernel/kernel/files/patches/mageia/ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch @@ -0,0 +1,42 @@ +From: Tejun Heo +Subject: [PATCH v2] libata: disable forced PORTS_IMPL for >= AHCI 1.3 +Date: Fri, 15 Jan 2016 15:13:05 -0500 + +Some early controllers incorrectly reported zero ports in PORTS_IMPL +register and the ahci driver fabricates PORTS_IMPL from the number of +ports in those cases. This hasn't mattered but with the new nvme +controllers there are cases where zero PORTS_IMPL is valid and should +be honored. + +Disable the workaround for >= AHCI 1.3. + +Signed-off-by: Tejun Heo +Reported-by: Andy Lutomirski +Link: http://lkml.kernel.org/g/CALCETrU7yMvXEDhjAUShoHEhDwifJGapdw--BKxsP0jmjKGmRw@mail.gmail.com +--- +Hello, Andy. + +Can you please see whether this one works? + +Thanks. + + drivers/ata/libahci.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c +index d61740e..a91432a 100644 +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -496,8 +496,9 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) + } + } + +- /* fabricate port_map from cap.nr_ports */ +- if (!port_map) { ++ /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ ++ if (!port_map && (!(vers >> 16) || ++ ((vers >> 16) == 1 && (vers & 0xFFFF) < 0x300))) { + port_map = (1 << ahci_nr_ports(cap)) - 1; + dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); + + diff --git a/kernel/kernel/files/patches/mageia/keys-fix-keyring-ref-leak-in-join_session_keyring.patch b/kernel/kernel/files/patches/mageia/keys-fix-keyring-ref-leak-in-join_session_keyring.patch new file mode 100644 index 00000000..6285e4cf --- /dev/null +++ b/kernel/kernel/files/patches/mageia/keys-fix-keyring-ref-leak-in-join_session_keyring.patch @@ -0,0 +1,82 @@ +From 23567fd052a9abb6d67fe8e7a9ccdd9800a540f2 Mon Sep 17 00:00:00 2001 +From: Yevgeny Pats +Date: Tue, 19 Jan 2016 22:09:04 +0000 +Subject: KEYS: Fix keyring ref leak in join_session_keyring() + +From: Yevgeny Pats + +commit 23567fd052a9abb6d67fe8e7a9ccdd9800a540f2 upstream. + +This fixes CVE-2016-0728. + +If a thread is asked to join as a session keyring the keyring that's already +set as its session, we leak a keyring reference. + +This can be tested with the following program: + + #include + #include + #include + #include + + int main(int argc, const char *argv[]) + { + int i = 0; + key_serial_t serial; + + serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, + "leaked-keyring"); + if (serial < 0) { + perror("keyctl"); + return -1; + } + + if (keyctl(KEYCTL_SETPERM, serial, + KEY_POS_ALL | KEY_USR_ALL) < 0) { + perror("keyctl"); + return -1; + } + + for (i = 0; i < 100; i++) { + serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, + "leaked-keyring"); + if (serial < 0) { + perror("keyctl"); + return -1; + } + } + + return 0; + } + +If, after the program has run, there something like the following line in +/proc/keys: + +3f3d898f I--Q--- 100 perm 3f3f0000 0 0 keyring leaked-keyring: empty + +with a usage count of 100 * the number of times the program has been run, +then the kernel is malfunctioning. If leaked-keyring has zero usages or +has been garbage collected, then the problem is fixed. + +Reported-by: Yevgeny Pats +Signed-off-by: David Howells +Acked-by: Don Zickus +Acked-by: Prarit Bhargava +Acked-by: Jarod Wilson +Signed-off-by: James Morris +Signed-off-by: Greg Kroah-Hartman + +--- + security/keys/process_keys.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/security/keys/process_keys.c ++++ b/security/keys/process_keys.c +@@ -794,6 +794,7 @@ long join_session_keyring(const char *na + ret = PTR_ERR(keyring); + goto error2; + } else if (keyring == new->session_keyring) { ++ key_put(keyring); + ret = 0; + goto error2; + } diff --git a/kernel/kernel/files/patches/mageia/series b/kernel/kernel/files/patches/mageia/series index aab0e49d..6c89e9a2 100644 --- a/kernel/kernel/files/patches/mageia/series +++ b/kernel/kernel/files/patches/mageia/series @@ -122,6 +122,9 @@ block-Make-CFQ-default-to-IOPS-mode-on-SSDs.patch # ahci ids ahci-add-new-Intel-device-IDs.patch +# ahci fix +ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch + ### ### File-system ### @@ -346,6 +349,9 @@ video-mageia-logo.patch ### Security ### +# CVE-2016-0728 +keys-fix-keyring-ref-leak-in-join_session_keyring.patch + ### ### Smack fixes ### diff --git a/kernel/kernel/pspec.xml b/kernel/kernel/pspec.xml index fc3136c6..d505a165 100644 --- a/kernel/kernel/pspec.xml +++ b/kernel/kernel/pspec.xml @@ -29,7 +29,7 @@ - + patches/mageia/x86-pci-toshiba-equium-a60-assign-busses.patch @@ -140,7 +140,9 @@ patches/mageia/3rd-viahss-2.6.35-buildfix.patch patches/mageia/3rd-viahss-3.0-buildfix.patch patches/mageia/3rd-rtl8723bs.patch - patches/mageia/ahci-add-new-Intel-device-IDs.patch + patches/mageia/ahci-add-new-Intel-device-IDs.patch + patches/mageia/ata-libata-disable-forced-PORTS_IMPL-for-AHCI-1.3.patch + patches/mageia/keys-fix-keyring-ref-leak-in-join_session_keyring.patch patches/mageia/arm-0001-dt-bindings-Add-root-properties-for-Raspberry-Pi-2.patch patches/mageia/arm-0002-ARM-bcm2835-Add-a-compat-string-for-bcm2836-machine-.patch patches/mageia/arm-0003-ARM-bcm2835-Add-Kconfig-support-for-bcm2836.patch @@ -208,9 +210,9 @@ - 2016-01-11 + 2016-01-25 4.4.0 - Version bump to 4.4.0 + Version bump to 4.4.0,add CVE-2016-0728 patch. security systemRestart