incoming
Subsystems (26)
Andrew Morton
maintainer16 patches, based on 17e7124aad766b3f158943acb51467f86220afe9.
Subsystems affected by this patch series:
MAINTAINERS
mailmap
mm/kasan
mm/gup
nds32
gcov
ocfs2
ia64
mm/pagecache
mm/kasan
mm/kfence
lib
Subsystem: MAINTAINERS
Marek Behún <[email protected]>:
MAINTAINERS: update CZ.NIC's Turris information
treewide: change my e-mail address, fix my name
Subsystem: mailmap
Jordan Crouse <[email protected]>:
mailmap: update email address for Jordan Crouse
Matthew Wilcox <[email protected]>:
.mailmap: fix old email addresses
Subsystem: mm/kasan
Arnd Bergmann <[email protected]>:
kasan: fix hwasan build for gcc
Walter Wu <[email protected]>:
kasan: remove redundant config option
Subsystem: mm/gup
Aili Yao <[email protected]>:
mm/gup: check page posion status for coredump.
Subsystem: nds32
Mike Rapoport <[email protected]>:
nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
Subsystem: gcov
Nick Desaulniers <[email protected]>:
gcov: re-fix clang-11+ support
Subsystem: ocfs2
Wengang Wang <[email protected]>:
ocfs2: fix deadlock between setattr and dio_end_io_write
Subsystem: ia64
Sergei Trofimovich <[email protected]>:
ia64: fix user_stack_pointer() for ptrace()
Subsystem: mm/pagecache
Jack Qiu <[email protected]>:
fs: direct-io: fix missing sdio->boundary
Subsystem: mm/kasan
Andrey Konovalov <[email protected]>:
kasan: fix conflict with page poisoning
Andrew Morton <[email protected]>:
lib/test_kasan_module.c: suppress unused var warning
Subsystem: mm/kfence
Marco Elver <[email protected]>:
kfence, x86: fix preemptible warning on KPTI-enabled systems
Subsystem: lib
Julian Braha <[email protected]>:
lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
.mailmap | 7 ++ Documentation/ABI/testing/debugfs-moxtet | 4 - Documentation/ABI/testing/debugfs-turris-mox-rwtm | 2 Documentation/ABI/testing/sysfs-bus-moxtet-devices | 6 +- Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia | 2 Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm | 10 +-- Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml | 2 MAINTAINERS | 13 +++- arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 arch/arm64/kernel/sleep.S | 2 arch/ia64/include/asm/ptrace.h | 8 -- arch/nds32/mm/cacheflush.c | 2 arch/x86/include/asm/kfence.h | 7 ++ arch/x86/kernel/acpi/wakeup_64.S | 2 drivers/bus/moxtet.c | 4 - drivers/firmware/turris-mox-rwtm.c | 4 - drivers/gpio/gpio-moxtet.c | 4 - drivers/leds/leds-turris-omnia.c | 4 - drivers/mailbox/armada-37xx-rwtm-mailbox.c | 4 - drivers/watchdog/armada_37xx_wdt.c | 4 - fs/direct-io.c | 5 + fs/ocfs2/aops.c | 11 --- fs/ocfs2/file.c | 8 ++ include/dt-bindings/bus/moxtet.h | 2 include/linux/armada-37xx-rwtm-mailbox.h | 2 include/linux/kasan.h | 2 include/linux/moxtet.h | 2 kernel/gcov/clang.c | 29 ++++++---- lib/Kconfig.debug | 6 +- lib/Kconfig.kasan | 9 --- lib/test_kasan_module.c | 2 mm/gup.c | 4 + mm/internal.h | 20 ++++++ mm/kasan/common.c | 2 mm/kasan/kasan.h | 2 mm/kasan/report_generic.c | 2 mm/page_poison.c | 4 + scripts/Makefile.kasan | 18 ++++-- security/Kconfig.hardening | 4 - 39 files changed, 136 insertions(+), 91 deletions(-)
Andrew Morton
maintainerPATCH 1/16 MAINTAINERS: update CZ.NIC's Turris information
From: Marek Behún <[email protected]>
Subject: MAINTAINERS: update CZ.NIC's Turris information
Add all the files maintained by Turris team, not only for MOX, but also for Omnia. Change website.
---
MAINTAINERS | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
MAINTAINERS renamed from MAINTAINERS~maintainers-update-cznics-turris-information +9 -2
@@ -1790,19 +1790,26 @@ F: drivers/net/ethernet/cortina/ F: drivers/pinctrl/pinctrl-gemini.c F: drivers/rtc/rtc-ftrtc010.c -ARM/CZ.NIC TURRIS MOX SUPPORT +ARM/CZ.NIC TURRIS SUPPORT M: Marek Behun <[email protected]> S: Maintained -W: http://mox.turris.cz +W: https://www.turris.cz/ F: Documentation/ABI/testing/debugfs-moxtet F: Documentation/ABI/testing/sysfs-bus-moxtet-devices F: Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm F: Documentation/devicetree/bindings/bus/moxtet.txt F: Documentation/devicetree/bindings/firmware/cznic,turris-mox-rwtm.txt F: Documentation/devicetree/bindings/gpio/gpio-moxtet.txt +F: Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml +F: Documentation/devicetree/bindings/watchdog/armada-37xx-wdt.txt F: drivers/bus/moxtet.c F: drivers/firmware/turris-mox-rwtm.c +F: drivers/leds/leds-turris-omnia.c +F: drivers/mailbox/armada-37xx-rwtm-mailbox.c F: drivers/gpio/gpio-moxtet.c +F: drivers/watchdog/armada_37xx_wdt.c +F: include/dt-bindings/bus/moxtet.h +F: include/linux/armada-37xx-rwtm-mailbox.h F: include/linux/moxtet.h ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6)
_
Andrew Morton
maintainerPATCH 2/16 treewide: change my e-mail address, fix my name
In reply to Andrew MortonFrom: Marek Behún <[email protected]>
Subject: treewide: change my e-mail address, fix my name
Change my e-mail address to [email protected], and fix my name in non-code parts (add diacritical mark).
---
Documentation/ABI/testing/debugfs-moxtet | 4 ++-- Documentation/ABI/testing/debugfs-turris-mox-rwtm | 2 +- Documentation/ABI/testing/sysfs-bus-moxtet-devices | 6 +++--- Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia | 2 +- Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm | 10 +++++----- Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml | 2 +- MAINTAINERS | 2 +- arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 2 +- drivers/bus/moxtet.c | 4 ++-- drivers/firmware/turris-mox-rwtm.c | 4 ++-- drivers/gpio/gpio-moxtet.c | 4 ++-- drivers/leds/leds-turris-omnia.c | 4 ++-- drivers/mailbox/armada-37xx-rwtm-mailbox.c | 4 ++-- drivers/watchdog/armada_37xx_wdt.c | 4 ++-- include/dt-bindings/bus/moxtet.h | 2 +- include/linux/armada-37xx-rwtm-mailbox.h | 2 +- include/linux/moxtet.h | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-)
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts renamed from arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -1,7 +1,7 @@ // SPDX-License-Identifier: (GPL-2.0+ OR MIT) /* * Device Tree file for CZ.NIC Turris Mox Board - * 2019 by Marek Behun <[email protected]> + * 2019 by Marek Behún <[email protected]> */ /dts-v1/;
Documentation/ABI/testing/debugfs-moxtet renamed from Documentation/ABI/testing/debugfs-moxtet~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -1,7 +1,7 @@ What: /sys/kernel/debug/moxtet/input Date: March 2019 KernelVersion: 5.3 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Read input from the shift registers, in hexadecimal. Returns N+1 bytes, where N is the number of Moxtet connected modules. The first byte is from the CPU board itself.
@@ -19,7 +19,7 @@ Description: (Read) Read input from the What: /sys/kernel/debug/moxtet/output Date: March 2019 KernelVersion: 5.3 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (RW) Read last written value to the shift registers, in hexadecimal, or write values to the shift registers, also in hexadecimal.
Documentation/ABI/testing/debugfs-turris-mox-rwtm renamed from Documentation/ABI/testing/debugfs-turris-mox-rwtm~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -1,7 +1,7 @@ What: /sys/kernel/debug/turris-mox-rwtm/do_sign Date: Jun 2020 KernelVersion: 5.8 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: ======= ===========================================================
Documentation/ABI/testing/sysfs-bus-moxtet-devices renamed from Documentation/ABI/testing/sysfs-bus-moxtet-devices~treewide-change-my-e-mail-address-fix-my-name +3 -3
@@ -1,17 +1,17 @@ What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_description Date: March 2019 KernelVersion: 5.3 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Moxtet module description. Format: string What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_id Date: March 2019 KernelVersion: 5.3 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Moxtet module ID. Format: %x What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_name Date: March 2019 KernelVersion: 5.3 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Moxtet module name. Format: string
Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia renamed from Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -1,7 +1,7 @@ What: /sys/class/leds/<led>/device/brightness Date: July 2020 KernelVersion: 5.9 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (RW) On the front panel of the Turris Omnia router there is also a button which can be used to control the intensity of all the LEDs at once, so that if they are too bright, user can dim them.
Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm renamed from Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm~treewide-change-my-e-mail-address-fix-my-name +5 -5
@@ -1,21 +1,21 @@ What: /sys/firmware/turris-mox-rwtm/board_version Date: August 2019 KernelVersion: 5.4 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Board version burned into eFuses of this Turris Mox board. Format: %i What: /sys/firmware/turris-mox-rwtm/mac_address* Date: August 2019 KernelVersion: 5.4 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) MAC addresses burned into eFuses of this Turris Mox board. Format: %pM What: /sys/firmware/turris-mox-rwtm/pubkey Date: August 2019 KernelVersion: 5.4 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) ECDSA public key (in pubkey hex compressed form) computed as pair to the ECDSA private key burned into eFuses of this Turris Mox Board.
@@ -24,7 +24,7 @@ Description: (Read) ECDSA public key (in What: /sys/firmware/turris-mox-rwtm/ram_size Date: August 2019 KernelVersion: 5.4 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) RAM size in MiB of this Turris Mox board as was detected during manufacturing and burned into eFuses. Can be 512 or 1024. Format: %i
@@ -32,6 +32,6 @@ Description: (Read) RAM size in MiB of t What: /sys/firmware/turris-mox-rwtm/serial_number Date: August 2019 KernelVersion: 5.4 -Contact: Marek Behún <[email protected]> +Contact: Marek Behún <[email protected]> Description: (Read) Serial number burned into eFuses of this Turris Mox device. Format: %016X
Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml renamed from Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-sche title: CZ.NIC's Turris Omnia LEDs driver maintainers: - - Marek Behún <[email protected]> + - Marek Behún <[email protected]> description: This module adds support for the RGB LEDs found on the front panel of the
drivers/bus/moxtet.c renamed from drivers/bus/moxtet.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * Turris Mox module configuration bus driver * -* Copyright (C) 2019 Marek Behun <[email protected]> +* Copyright (C) 2019 Marek Behún <[email protected]> */ #include <dt-bindings/bus/moxtet.h>
@@ -879,6 +879,6 @@ static void __exit moxtet_exit(void) }module_exit (moxtet_exit); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );MODULE_DESCRIPTION ("CZ.NIC's Turris Mox module configuration bus" );MODULE_LICENSE ("GPL v2" );
drivers/firmware/turris-mox-rwtm.c renamed from drivers/firmware/turris-mox-rwtm.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * Turris Mox rWTM firmware driver * -* Copyright (C) 2019 Marek Behun <[email protected]> +* Copyright (C) 2019 Marek Behún <[email protected]> */ #include <linux/armada-37xx-rwtm-mailbox.h>
@@ -547,4 +547,4 @@ module_platform_driver(turris_mox_rwtm_dMODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("Turris Mox rWTM firmware driver" ); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );
drivers/gpio/gpio-moxtet.c renamed from drivers/gpio/gpio-moxtet.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * Turris Mox Moxtet GPIO expander * -* Copyright (C) 2018 Marek Behun <[email protected]> +* Copyright (C) 2018 Marek Behún <[email protected]> */ #include <linux/bitops.h>
@@ -174,6 +174,6 @@ static struct moxtet_driver moxtet_gpio_ };module_moxtet_driver (moxtet_gpio_driver); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );MODULE_DESCRIPTION ("Turris Mox Moxtet GPIO expander" );MODULE_LICENSE ("GPL v2" );
drivers/leds/leds-turris-omnia.c renamed from drivers/leds/leds-turris-omnia.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * CZ.NIC's Turris Omnia LEDs driver * -* 2020 by Marek Behun <[email protected]> +* 2020 by Marek Behún <[email protected]> */ #include <linux/i2c.h>
@@ -287,6 +287,6 @@ static struct i2c_driver omnia_leds_drivmodule_i2c_driver (omnia_leds_driver); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );MODULE_DESCRIPTION ("CZ.NIC's Turris Omnia LEDs" );MODULE_LICENSE ("GPL v2" );
drivers/mailbox/armada-37xx-rwtm-mailbox.c renamed from drivers/mailbox/armada-37xx-rwtm-mailbox.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * rWTM BIU Mailbox driver for Armada 37xx * -* Author: Marek Behun <[email protected]> +* Author: Marek Behún <[email protected]> */ #include <linux/device.h>
@@ -203,4 +203,4 @@ module_platform_driver(armada_37xx_mbox_MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("rWTM BIU Mailbox driver for Armada 37xx" ); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );
drivers/watchdog/armada_37xx_wdt.c renamed from drivers/watchdog/armada_37xx_wdt.c~treewide-change-my-e-mail-address-fix-my-name +2 -2
@@ -2,7 +2,7 @@/* * Watchdog driver for Marvell Armada 37xx SoCs * -* Author: Marek Behun <[email protected]> +* Author: Marek Behún <[email protected]> */ #include <linux/clk.h>
@@ -366,7 +366,7 @@ static struct platform_driver armada_37xmodule_platform_driver (armada_37xx_wdt_driver); -MODULE_AUTHOR ("Marek Behun <[email protected]>" ); +MODULE_AUTHOR ("Marek Behun <[email protected]>" );MODULE_DESCRIPTION ("Armada 37xx CPU Watchdog" );MODULE_LICENSE ("GPL v2" );
include/dt-bindings/bus/moxtet.h renamed from include/dt-bindings/bus/moxtet.h~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -2,7 +2,7 @@/* * Constant for device tree bindings for Turris Mox module configuration bus * -* Copyright (C) 2019 Marek Behun <[email protected]> +* Copyright (C) 2019 Marek Behún <[email protected]> */ #ifndef _DT_BINDINGS_BUS_MOXTET_H
include/linux/armada-37xx-rwtm-mailbox.h renamed from include/linux/armada-37xx-rwtm-mailbox.h~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -2,7 +2,7 @@/* * rWTM BIU Mailbox driver for Armada 37xx * -* Author: Marek Behun <[email protected]> +* Author: Marek Behún <[email protected]> */ #ifndef _LINUX_ARMADA_37XX_RWTM_MAILBOX_H_
include/linux/moxtet.h renamed from include/linux/moxtet.h~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -2,7 +2,7 @@/* * Turris Mox module configuration bus driver * -* Copyright (C) 2019 Marek Behun <[email protected]> +* Copyright (C) 2019 Marek Behún <[email protected]> */ #ifndef __LINUX_MOXTET_H
MAINTAINERS renamed from MAINTAINERS~treewide-change-my-e-mail-address-fix-my-name +1 -1
@@ -1791,7 +1791,7 @@ F: drivers/pinctrl/pinctrl-gemini.c F: drivers/rtc/rtc-ftrtc010.c ARM/CZ.NIC TURRIS SUPPORT -M: Marek Behun <[email protected]> +M: Marek Behun <[email protected]> S: Maintained W: https://www.turris.cz/ F: Documentation/ABI/testing/debugfs-moxtet
_
Andrew Morton
maintainerPATCH 3/16 mailmap: update email address for Jordan Crouse
In reply to Andrew MortonFrom: Jordan Crouse <[email protected]>
Subject: mailmap: update email address for Jordan Crouse
jcrouse at codeaurora.org has started bouncing. Redirect to a more permanent address.
---
.mailmap | 1 + 1 file changed, 1 insertion(+)
.mailmap renamed from .mailmap~mailmap-update-email-address-for-jordan-crouse +1 -0
@@ -168,6 +168,7 @@ Johan Hovold <[email protected]> <jhovold Johan Hovold <[email protected]> <[email protected]> John Paul Adrian Glaubitz <[email protected]> John Stultz <[email protected]> +Jordan Crouse <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]>
_
Andrew Morton
maintainerPATCH 4/16 .mailmap: fix old email addresses
In reply to Andrew MortonFrom: Matthew Wilcox <[email protected]>
Subject: .mailmap: fix old email addresses
Update Nick & Nadia's old addresses.
---
.mailmap | 6 ++++++ 1 file changed, 6 insertions(+)
.mailmap renamed from .mailmap~old-email-addresses-in-mailmap +6 -0
@@ -254,8 +254,14 @@ Morten Welinder <[email protected] Morten Welinder <[email protected]> Morten Welinder <[email protected]> Mythri P K <[email protected]> +Nadia Yvette Chambers <[email protected]> William Lee Irwin III <[email protected]> Nathan Chancellor <[email protected]> <[email protected]> Nguyen Anh Quynh <[email protected]> +Nicholas Piggin <[email protected]> <[email protected]> +Nicholas Piggin <[email protected]> <[email protected]> +Nicholas Piggin <[email protected]> <[email protected]> +Nicholas Piggin <[email protected]> <[email protected]> +Nicholas Piggin <[email protected]> <[email protected]> Nicolas Ferre <[email protected]> <[email protected]> Nicolas Pitre <[email protected]> <[email protected]> Nicolas Pitre <[email protected]> <[email protected]>
_
Andrew Morton
maintainerPATCH 5/16 kasan: fix hwasan build for gcc
In reply to Andrew MortonFrom: Arnd Bergmann <[email protected]>
Subject: kasan: fix hwasan build for gcc
gcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes possible to enable CONFIG_KASAN_SW_TAGS.
Unfortunately this fails to build at the moment, because the corresponding command line arguments use llvm specific syntax.
Change it to use the cc-param macro instead, which works on both clang and gcc.
---
scripts/Makefile.kasan | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/Makefile.kasan renamed from scripts/Makefile.kasan~kasan-fix-hwasan-build-for-gcc +4 -4
@@ -36,14 +36,14 @@ endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS ifdef CONFIG_KASAN_INLINE - instrumentation_flags := -mllvm -hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET) + instrumentation_flags := $(call cc-param,hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET)) else - instrumentation_flags := -mllvm -hwasan-instrument-with-calls=1 + instrumentation_flags := $(call cc-param,hwasan-instrument-with-calls=1) endif CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ - -mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \ - -mllvm -hwasan-use-short-granules=0 \ + $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,hwasan-use-short-granules=0) \ $(instrumentation_flags) endif # CONFIG_KASAN_SW_TAGS
_
Andrey Konovalov
reviewerRe: [patch 05/16] kasan: fix hwasan build for gcc
Quoted 51 lines · Andrew Morton
From: Arnd Bergmann <[email protected]>
Subject: kasan: fix hwasan build for gccgcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes possible to enable
CONFIG_KASAN_SW_TAGS.Unfortunately this fails to build at the moment, because the corresponding command line arguments use llvm specific syntax.
Change it to use the cc-param macro instead, which works on both clang and gcc.
Signed-off-by Arnd Bergmann <[email protected]>Reviewed-by Marco Elver <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Michal Marek <[email protected]>Cc Andrey Ryabinin <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Nick Desaulniers <[email protected]>Cc Alexander Potapenko <[email protected]>Cc Andrey Konovalov <[email protected]>Cc Dmitry Vyukov <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
scripts/Makefile.kasan | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)scripts/Makefile.kasan renamed from scripts/Makefile.kasan~kasan-fix-hwasan-build-for-gcc +4
-4@@ -36,14 +36,14 @@ endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS ifdef CONFIG_KASAN_INLINE - instrumentation_flags := -mllvm -hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET) + instrumentation_flags := $(call cc-param,hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET)) else - instrumentation_flags := -mllvm -hwasan-instrument-with-calls=1 + instrumentation_flags := $(call cc-param,hwasan-instrument-with-calls=1) endif CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ - -mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \ - -mllvm -hwasan-use-short-granules=0 \ + $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,hwasan-use-short-granules=0) \ $(instrumentation_flags) endif # CONFIG_KASAN_SW_TAGS
Quoted 1 line
_
Hi,
As I commented on the patch, this breaks SW_TAGS build with Clang for me with:
arch/arm64/include/asm/current.h:19: undefined reference to `__hwasan_tls'
The reason for this is that cc-param is only defined for KASAN_GENERIC, the definition needs to be moved.
Thanks!
Andrew Morton
maintainerRe: [patch 05/16] kasan: fix hwasan build for gcc
Quoted 4 lines · On Fri, 9 Apr 2021 22:39:46 +0200 Andrey Konovalov <[email protected]> wrote:
Quoted 3 lines
endif #
CONFIG_KASAN_SW_TAGS
_
Quoted 9 lines
Hi,
As I commented on the patch, this breaks
SW_TAGSbuild with Clang for me with:
arch/arm64/include/asm/current.h:19: undefined reference to `__hwasan_tls'The reason for this is that cc-param is only defined for
KASAN_GENERIC, the definition needs to be moved.
Oh. I thought that had been fixed.
Please send a patch?
Marco Elver
maintainerRe: [patch 05/16] kasan: fix hwasan build for gcc
Quoted 12 lines · Andrew Morton
Quoted 10 lines · On Fri, 9 Apr 2021 22:39:46 +0200 Andrey Konovalov <[email protected]> wrote:
Quoted 3 lines
endif #
CONFIG_KASAN_SW_TAGS
_Hi,
As I commented on the patch, this breaks
SW_TAGSbuild with Clang for me with:
arch/arm64/include/asm/current.h:19: undefined reference to `__hwasan_tls'
Quoted 7 lines
Quoted 3 lines
The reason for this is that cc-param is only defined for
KASAN_GENERIC, the definition needs to be moved.Oh. I thought that had been fixed.
Please send a patch?
I think we need something like the below.
Unless a fixed version has already been sent, feel free to squash (applies immediately after "kasan: fix hwasan build for gcc", and before the conflicting "kasan: remove redundant config option").
Thanks,
-- Marco
------ >8 ------
From: Marco Elver <[email protected]>
Date: Sun, 11 Apr 2021 21:32:01 +0200
Subject: [PATCH] fixup for "kasan: fix hwasan build for gcc"
--- scripts/Makefile.kasan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.kasan +2 -2
@@ -2,6 +2,8 @@ CFLAGS_KASAN_NOSANITIZE := -fno-builtin KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) +cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE
@@ -12,8 +14,6 @@ endif CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address -cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) - # -fasan-shadow-offset fails without -fsanitize CFLAGS_KASAN_SHADOW := $(call cc-option, -fsanitize=kernel-address \ -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET), \
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog
Andrey Konovalov
reviewerRe: [patch 05/16] kasan: fix hwasan build for gcc
Quoted 65 lines · Marco Elver
Quoted 12 lines · Andrew Morton
Quoted 10 lines · On Fri, 9 Apr 2021 22:39:46 +0200 Andrey Konovalov <[email protected]> wrote:
Quoted 3 lines
endif #
CONFIG_KASAN_SW_TAGS
_Hi,
As I commented on the patch, this breaks
SW_TAGSbuild with Clang for me with:
arch/arm64/include/asm/current.h:19: undefined reference to `__hwasan_tls'Quoted 7 lines
Quoted 3 lines
The reason for this is that cc-param is only defined for
KASAN_GENERIC, the definition needs to be moved.Oh. I thought that had been fixed.
Please send a patch?
I think we need something like the below.
Unless a fixed version has already been sent, feel free to squash (applies immediately after "kasan: fix hwasan build for gcc", and before the conflicting "kasan: remove redundant config option").
Thanks,
-- Marco------ >8 ------
From: Marco Elver <[email protected]>
Date: Sun, 11 Apr 2021 21:32:01 +0200
Subject: [PATCH] fixup for "kasan: fix hwasan build for gcc"Signed-off-by Marco Elver <[email protected]>--- scripts/Makefile.kasan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/Makefile.kasan +2
-3@@ -2,6 +2,8 @@ CFLAGS_KASAN_NOSANITIZE := -fno-builtin KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) +cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE@@ -12,8 +14,6 @@ endif CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address -cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) - # -fasan-shadow-offset fails without -fsanitize CFLAGS_KASAN_SHADOW := $(call cc-option, -fsanitize=kernel-address \ -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET), \ --
Quoted 2 lines
2.31.1.295.g9ea45b61b8-goog
This fix-up looks good to me.
Thank you, Marco!
Re: [patch 05/16] kasan: fix hwasan build for gcc
In reply to Andrey KonovalovQuoted 4 lines · Andrey Konovalov
As I commented on the patch, this breaks
SW_TAGSbuild with Clang for me with:
arch/arm64/include/asm/current.h:19: undefined reference to `__hwasan_tls'
I've dropped this patch and the next one ("[PATCH 06/16] kasan: remove redundant config option") that depended on it.
Linus
Andrew Morton
maintainerPATCH 6/16 kasan: remove redundant config option
In reply to Andrew MortonFrom: Walter Wu <[email protected]>
Subject: kasan: remove redundant config option
CONFIG_KASAN_STACK and CONFIG_KASAN_STACK_ENABLE both enable KASAN stack instrumentation, but we should only need one config, so that we remove CONFIG_KASAN_STACK_ENABLE and make CONFIG_KASAN_STACK workable. see [1].
When enable KASAN stack instrumentation, then for gcc we could do no prompt and default value y, and for clang prompt and default value n.
This patch fixes the following compilation warning:
include/linux/kasan.h:333:30: warning: 'CONFIG_KASAN_STACK' is not defined, evaluates to 0 [-Wundef]
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=210221
---
arch/arm64/kernel/sleep.S | 2 +- arch/x86/kernel/acpi/wakeup_64.S | 2 +- include/linux/kasan.h | 2 +- lib/Kconfig.kasan | 9 ++------- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 2 +- mm/kasan/report_generic.c | 2 +- scripts/Makefile.kasan | 10 ++++++++-- security/Kconfig.hardening | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-)
arch/arm64/kernel/sleep.S renamed from arch/arm64/kernel/sleep.S~kasan-remove-redundant-config-option +1 -1
@@ -134,7 +134,7 @@ SYM_FUNC_START(_cpu_resume) */ bl cpu_do_resume -#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) mov x0, sp bl kasan_unpoison_task_stack_below #endif
arch/x86/kernel/acpi/wakeup_64.S renamed from arch/x86/kernel/acpi/wakeup_64.S~kasan-remove-redundant-config-option +1 -1
@@ -115,7 +115,7 @@ SYM_FUNC_START(do_suspend_lowlevel) movq pt_regs_r14(%rax), %r14 movq pt_regs_r15(%rax), %r15 -#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) /* * The suspend path may have poisoned some areas deeper in the stack, * which we now need to unpoison.
include/linux/kasan.h renamed from include/linux/kasan.h~kasan-remove-redundant-config-option +1 -1
@@ -330,7 +330,7 @@ static inline bool kasan_check_byte(cons#endif /* CONFIG_KASAN */ -#if defined(CONFIG_KASAN ) &&CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN ) && defined(CONFIG_KASAN_STACK )void kasan_unpoison_task_stack (struct task_struct *task);#else static inline void kasan_unpoison_task_stack (struct task_struct *task) {}
lib/Kconfig.kasan renamed from lib/Kconfig.kasan~kasan-remove-redundant-config-option +2 -7
@@ -138,9 +138,10 @@ config KASAN_INLINE endchoice -config KASAN_STACK_ENABLE +config KASAN_STACK bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST depends on KASAN_GENERIC || KASAN_SW_TAGS + default y if CC_IS_GCC help The LLVM stack address sanitizer has a know problem that causes excessive stack usage in a lot of functions, see
@@ -154,12 +155,6 @@ config KASAN_STACK_ENABLE CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe to use and enabled by default. -config KASAN_STACK - int - depends on KASAN_GENERIC || KASAN_SW_TAGS - default 1 if KASAN_STACK_ENABLE || CC_IS_GCC - default 0 - config KASAN_SW_TAGS_IDENTIFY bool "Enable memory corruption identification" depends on KASAN_SW_TAGS
mm/kasan/common.c renamed from mm/kasan/common.c~kasan-remove-redundant-config-option +1 -1
@@ -63,7 +63,7 @@ void __kasan_unpoison_range(const void *kasan_unpoison (address, size); } -#if CONFIG_KASAN_STACK +#ifdef CONFIG_KASAN_STACK /* Unpoison the entire stack for a task. */ void kasan_unpoison_task_stack (struct task_struct *task) {
mm/kasan/kasan.h renamed from mm/kasan/kasan.h~kasan-remove-redundant-config-option +1 -1
@@ -231,7 +231,7 @@ void *kasan_find_first_bad_addr(void *adconst char *kasan_get_bug_type (struct kasan_access_info *info);void kasan_metadata_fetch_row (char *buffer,void *row); -#if defined(CONFIG_KASAN_GENERIC ) &&CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN_GENERIC ) && defined(CONFIG_KASAN_STACK )void kasan_print_address_stack_frame (const void *addr);#else static inline void kasan_print_address_stack_frame (const void *addr) { }
mm/kasan/report_generic.c renamed from mm/kasan/report_generic.c~kasan-remove-redundant-config-option +1 -1
@@ -128,7 +128,7 @@ void kasan_metadata_fetch_row(char *buffmemcpy (buffer,kasan_mem_to_shadow (row),META_BYTES_PER_ROW ); } -#if CONFIG_KASAN_STACK +#ifdef CONFIG_KASAN_STACK static bool __must_check tokenize_frame_descr (const char **frame_descr,char *token,size_t max_tok_len,unsigned long *value)
scripts/Makefile.kasan renamed from scripts/Makefile.kasan~kasan-remove-redundant-config-option +8 -2
@@ -2,6 +2,12 @@ CFLAGS_KASAN_NOSANITIZE := -fno-builtin KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) +ifdef CONFIG_KASAN_STACK + stack_enable := 1 +else + stack_enable := 0 +endif + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE
@@ -27,7 +33,7 @@ else CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ $(call cc-param,asan-globals=1) \ $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ - $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,asan-stack=$(stack_enable)) \ $(call cc-param,asan-instrument-allocas=1) endif
@@ -42,7 +48,7 @@ else endif CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ - $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,hwasan-instrument-stack=$(stack_enable)) \ $(call cc-param,hwasan-use-short-granules=0) \ $(instrumentation_flags)
security/Kconfig.hardening renamed from security/Kconfig.hardening~kasan-remove-redundant-config-option +2 -2
@@ -64,7 +64,7 @@ choice config GCC_PLUGIN_STRUCTLEAK_BYREF bool "zero-init structs passed by reference (strong)" depends on GCC_PLUGINS - depends on !(KASAN && KASAN_STACK=1) + depends on !(KASAN && KASAN_STACK) select GCC_PLUGIN_STRUCTLEAK help Zero-initialize any structures on the stack that may
@@ -82,7 +82,7 @@ choice config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL bool "zero-init anything passed by reference (very strong)" depends on GCC_PLUGINS - depends on !(KASAN && KASAN_STACK=1) + depends on !(KASAN && KASAN_STACK) select GCC_PLUGIN_STRUCTLEAK help Zero-initialize any stack variables that may be passed
_
Andrew Morton
maintainerPATCH 7/16 mm/gup: check page posion status for coredump.
In reply to Andrew MortonFrom: Aili Yao <[email protected]>
Subject: mm/gup: check page posion status for coredump.
When we do coredump for user process signal, this may be an SIGBUS signal with BUS_MCEERR_AR or BUS_MCEERR_AO code, which means this signal is resulted from ECC memory fail like SRAR or SRAO, we expect the memory recovery work is finished correctly, then the get_dump_page() will not return the error page as its process pte is set invalid by memory_failure().
But memory_failure() may fail, and the process's related pte may not be correctly set invalid, for current code, we will return the poison page, get it dumped, and then lead to system panic as its in kernel code.
So check the poison status in get_dump_page(), and if TRUE, return NULL.
There maybe other scenario that is also better to check the posion status and not to panic, so make a wrapper for this check, Thanks to David's suggestion(<[email protected]>).
---
mm/gup.c | 4 ++++ mm/internal.h | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+)
mm/gup.c renamed from mm/gup.c~mm-gup-check-page-posion-status-for-coredump +4 -0
@@ -1535,6 +1535,10 @@ struct page *get_dump_page(unsigned long FOLL_FORCE | FOLL_DUMP | FOLL_GET);if (locked)mmap_read_unlock (mm); + +if (ret ==1 &&is_page_poisoned (page)) +return NULL ; + return (ret == 1) ? page : NULL; }#endif /* CONFIG_ELF_CORE */
mm/internal.h renamed from mm/internal.h~mm-gup-check-page-posion-status-for-coredump +20 -0
@@ -97,6 +97,26 @@ static inline void set_page_refcounted(sset_page_count (page,1 ); } +/* +* When kernel touch the user page, the user page may be have been marked +* poison but still mapped in user space, if without this page, the kernel +* can guarantee the data integrity and operation success, the kernel is +* better to check the posion status and avoid touching it, be good not to +* panic, coredump for process fatal signal is a sample case matching this +* scenario. Or if kernel can't guarantee the data integrity, it's better +* not to call this function, let kernel touch the poison page and get to +* panic. +*/ +static inline bool is_page_poisoned (struct page *page) +{ +if (PageHWPoison (page)) +return true; +else if (PageHuge (page) &&PageHWPoison (compound_head (page))) +return true; + +return false; +} +extern unsigned long highest_memmap_pfn;/*
_
Andrew Morton
maintainerPATCH 8/16 nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
In reply to Andrew MortonFrom: Mike Rapoport <[email protected]>
Subject: nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
Commit cb9f753a3731 ("mm: fix races between swapoff and flush dcache") updated flush_dcache_page implementations on several architectures to use page_mapping_file() in order to avoid races between page_mapping() and swapoff().
This update missed arch/nds32 and there is a possibility of a race there.
Replace page_mapping() with page_mapping_file() in nds32 implementation of flush_dcache_page().
---
arch/nds32/mm/cacheflush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nds32/mm/cacheflush.c renamed from arch/nds32/mm/cacheflush.c~nds32-flush_dcache_page-use-page_mapping_file-to-avoid-races-with-swapoff +1 -1
@@ -238,7 +238,7 @@ void flush_dcache_page(struct page *page {struct address_space *mapping; - mapping =page_mapping (page); + mapping =page_mapping_file (page);if (mapping && !mapping_mapped (mapping))set_bit (PG_dcache_dirty, &page->flags);else {
_
Andrew Morton
maintainerPATCH 9/16 gcov: re-fix clang-11+ support
In reply to Andrew MortonFrom: Nick Desaulniers <[email protected]>
Subject: gcov: re-fix clang-11+ support
LLVM changed the expected function signature for llvm_gcda_emit_function() in the clang-11 release. Users of clang-11 or newer may have noticed their kernels producing invalid coverage information:
$ llvm-cov gcov -a -c -u -f -b <input>.gcda -- gcno=<input>.gcno 1 <func>: checksum mismatch, \ (<lineno chksum A>, <cfg chksum B>) != (<lineno chksum A>, <cfg chksum C>) 2 Invalid .gcda File! ...
Fix up the function signatures so calling this function interprets its parameters correctly and computes the correct cfg checksum. In particular, in clang-11, the additional checksum is no longer optional.
---
kernel/gcov/clang.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
kernel/gcov/clang.c renamed from kernel/gcov/clang.c~gcov-re-fix-clang-11-support +19 -10
@@ -70,7 +70,9 @@ struct gcov_fn_info {u32 ident;u32 checksum; +#if CONFIG_CLANG_VERSION <110000 u8 use_extra_checksum; +#endif u32 cfg_checksum;u32 num_counters;
@@ -145,10 +147,8 @@ void llvm_gcda_emit_function(u32 ident, list_add_tail(&info->head, ¤t_info->functions); } -EXPORT_SYMBOL (llvm_gcda_emit_function);#else -void llvm_gcda_emit_function (u32 ident,u32 func_checksum, -u8 use_extra_checksum,u32 cfg_checksum) +void llvm_gcda_emit_function (u32 ident,u32 func_checksum,u32 cfg_checksum) {struct gcov_fn_info *info =kzalloc (sizeof (*info),GFP_KERNEL );
@@ -158,12 +158,11 @@ void llvm_gcda_emit_function(u32 ident,INIT_LIST_HEAD (&info->head); info->ident = ident; info->checksum = func_checksum; - info->use_extra_checksum = use_extra_checksum; info->cfg_checksum = cfg_checksum; list_add_tail(&info->head, ¤t_info->functions); } -EXPORT_SYMBOL (llvm_gcda_emit_function);#endif +EXPORT_SYMBOL (llvm_gcda_emit_function);void llvm_gcda_emit_arcs (u32 num_counters,u64 *counters) {
@@ -293,11 +292,16 @@ int gcov_info_is_compatible(struct gcov_ !list_is_last(&fn_ptr2->head, &info2->functions)) {if (fn_ptr1->checksum != fn_ptr2->checksum)return false; +#if CONFIG_CLANG_VERSION <110000 if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum)return false;if (fn_ptr1->use_extra_checksum && fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum)return false; +#else +if (fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) +return false; +#endif fn_ptr1 =list_next_entry (fn_ptr1, head); fn_ptr2 =list_next_entry (fn_ptr2, head); }
@@ -529,17 +533,22 @@ static size_t convert_to_gcda(char *bufflist_for_each_entry (fi_ptr, &info->functions, head) {u32 i; -u32 len =2 ; - -if (fi_ptr->use_extra_checksum) - len++; pos +=store_gcov_u32 (buffer, pos,GCOV_TAG_FUNCTION ); - pos +=store_gcov_u32 (buffer, pos, len); +#if CONFIG_CLANG_VERSION <110000 + pos +=store_gcov_u32 (buffer, pos, + fi_ptr->use_extra_checksum ?3 :2 ); +#else + pos +=store_gcov_u32 (buffer, pos,3 ); +#endif pos +=store_gcov_u32 (buffer, pos, fi_ptr->ident); pos +=store_gcov_u32 (buffer, pos, fi_ptr->checksum); +#if CONFIG_CLANG_VERSION <110000 if (fi_ptr->use_extra_checksum) pos +=store_gcov_u32 (buffer, pos, fi_ptr->cfg_checksum); +#else + pos +=store_gcov_u32 (buffer, pos, fi_ptr->cfg_checksum); +#endif pos +=store_gcov_u32 (buffer, pos,GCOV_TAG_COUNTER_BASE ); pos +=store_gcov_u32 (buffer, pos, fi_ptr->num_counters *2 );
_
Andrew Morton
maintainerPATCH 10/16 ocfs2: fix deadlock between setattr and dio_end_io_write
In reply to Andrew MortonFrom: Wengang Wang <[email protected]>
Subject: ocfs2: fix deadlock between setattr and dio_end_io_write
The following deadlock is detected:
truncate -> setattr path is waiting for pending direct IO to be done ( inode->i_dio_count become zero) with inode->i_rwsem held (down_write).
PID: 14827 TASK: ffff881686a9af80 CPU: 20 COMMAND: "ora_p005_hrltd9" #0 [ffffc9000bcf3c08] __schedule at ffffffff818667cc
#1 [ffffc9000bcf3ca0] schedule at ffffffff81866de6
#2 [ffffc9000bcf3cb8] inode_dio_wait at ffffffff812a2d04
#3 [ffffc9000bcf3d28] ocfs2_setattr at ffffffffc05f322e [ocfs2] #4 [ffffc9000bcf3e18] notify_change at ffffffff812a5a09
#5 [ffffc9000bcf3e60] do_truncate at ffffffff812808f5
#6 [ffffc9000bcf3ed8] do_sys_ftruncate.constprop.18 at ffffffff81280cf2 #7 [ffffc9000bcf3f18] sys_ftruncate at ffffffff81280d8e
#8 [ffffc9000bcf3f28] do_syscall_64 at ffffffff81003949
#9 [ffffc9000bcf3f50] entry_SYSCALL_64_after_hwframe at ffffffff81a001ad
dio completion path is going to complete one direct IO (decrement inode->i_dio_count), but before that it hang at locking inode->i_rwsem.
#0 [ffffc90009b47b40] __schedule+700 at ffffffff818667cc
#1 [ffffc90009b47bd8] schedule+54 at ffffffff81866de6
#2 [ffffc90009b47bf0] rwsem_down_write_failed+536 at ffffffff8186aa28 #3 [ffffc90009b47c88] call_rwsem_down_write_failed+23 at ffffffff8185a1b7 #4 [ffffc90009b47cd0] down_write+45 at ffffffff81869c9d
#5 [ffffc90009b47ce8] ocfs2_dio_end_io_write+180 at ffffffffc05d5444 [ocfs2] #6 [ffffc90009b47dd8] ocfs2_dio_end_io+85 at ffffffffc05d5a85 [ocfs2] #7 [ffffc90009b47e18] dio_complete+140 at ffffffff812c873c
#8 [ffffc90009b47e50] dio_aio_complete_work+25 at ffffffff812c89f9 #9 [ffffc90009b47e60] process_one_work+361 at ffffffff810b1889
#10 [ffffc90009b47ea8] worker_thread+77 at ffffffff810b233d
#11 [ffffc90009b47f08] kthread+261 at ffffffff810b7fd5
#12 [ffffc90009b47f50] ret_from_fork+62 at ffffffff81a0035e
Thus above forms ABBA deadlock. The same deadlock was mentioned in upstream commit 28f5a8a7c033cbf3e32277f4cc9c6afd74f05300. well, it seems that that commit just removed cluster lock (the victim of above dead lock) from the ABBA deadlock party.
End-user visible effects: Process hang in truncate -> ocfs2_setattr path and other processes hang at ocfs2_dio_end_io_write path.
This is to fix the deadlock itself. It removes inode_lock() call from dio completion path to remove the deadlock and add ip_alloc_sem lock in setattr path to synchronize the inode modifications.
---
fs/ocfs2/aops.c | 11 +---------- fs/ocfs2/file.c | 8 ++++++-- 2 files changed, 7 insertions(+), 12 deletions(-)
fs/ocfs2/aops.c renamed from fs/ocfs2/aops.c~ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write +1 -10
@@ -2295,7 +2295,7 @@ static int ocfs2_dio_end_io_write(structstruct ocfs2_alloc_context *meta_ac =NULL ;handle_t *handle =NULL ;loff_t end = offset + bytes; -int ret =0 , credits =0 , locked =0 ; +int ret =0 , credits =0 ;ocfs2_init_dealloc_ctxt (&dealloc);
@@ -2306,13 +2306,6 @@ static int ocfs2_dio_end_io_write(struct !dwc->dw_orphaned) goto out; -/* ocfs2_file_write_iter will get i_mutex, so we need not lock if we -* are in that context. */ -if (dwc->dw_writer_pid !=task_pid_nr (current)) { -inode_lock (inode); - locked =1 ; - } - ret =ocfs2_inode_lock (inode, &di_bh,1 );if (ret <0 ) {mlog_errno (ret);
@@ -2393,8 +2386,6 @@ out:if (meta_ac)ocfs2_free_alloc_context (meta_ac);ocfs2_run_deallocs (osb, &dealloc); -if (locked) -inode_unlock (inode);ocfs2_dio_free_write_ctx (inode, dwc);return ret;
fs/ocfs2/file.c renamed from fs/ocfs2/file.c~ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write +6 -2
@@ -1245,22 +1245,24 @@ int ocfs2_setattr(struct user_namespace goto bail_unlock; } } +down_write (&OCFS2_I (inode)->ip_alloc_sem); handle =ocfs2_start_trans (osb,OCFS2_INODE_UPDATE_CREDITS +2 *ocfs2_quota_trans_credits (sb));if (IS_ERR (handle)) { status =PTR_ERR (handle);mlog_errno (status); - goto bail_unlock; + goto bail_unlock_alloc; } status =__dquot_transfer (inode, transfer_to);if (status <0 ) goto bail_commit; }else { +down_write (&OCFS2_I (inode)->ip_alloc_sem); handle =ocfs2_start_trans (osb,OCFS2_INODE_UPDATE_CREDITS );if (IS_ERR (handle)) { status =PTR_ERR (handle);mlog_errno (status); - goto bail_unlock; + goto bail_unlock_alloc; } }
@@ -1273,6 +1275,8 @@ int ocfs2_setattr(struct user_namespace bail_commit:ocfs2_commit_trans (osb, handle); +bail_unlock_alloc: +up_write (&OCFS2_I (inode)->ip_alloc_sem); bail_unlock:if (status && inode_locked) {ocfs2_inode_unlock_tracker (inode,1 , &oh, had_lock);
_
Andrew Morton
maintainerPATCH 11/16 ia64: fix user_stack_pointer() for ptrace()
In reply to Andrew MortonFrom: Sergei Trofimovich <[email protected]>
Subject: ia64: fix user_stack_pointer() for ptrace()
ia64 has two stacks:
- memory stack (or stack), pointed at by by r12
- register backing store (register stack), pointed at ar.bsp/ar.bspstore with complications around dirty register frame on CPU.
In https://bugs.gentoo.org/769614 Dmitry noticed that PTRACE_GET_SYSCALL_INFO returns register stack instead memory stack.
The bug comes from the fact that user_stack_pointer() and current_user_stack_pointer() don't return the same register:
ulong user_stack_pointer(struct pt_regs *regs) { return regs->ar_bspstore; }
#define current_user_stack_pointer() (current_pt_regs()->r12)The change gets both back in sync.
I think ptrace(PTRACE_GET_SYSCALL_INFO) is the only affected user by this bug on ia64.
The change fixes 'rt_sigreturn.gen.test' strace test where it was observed initially.
---
arch/ia64/include/asm/ptrace.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/ia64/include/asm/ptrace.h renamed from arch/ia64/include/asm/ptrace.h~ia64-fix-user_stack_pointer-for-ptrace +1 -7
@@ -54,8 +54,7 @@static inline unsigned long user_stack_pointer (struct pt_regs *regs) { -/* FIXME: should this be bspstore + nr_dirty regs? */ -return regs->ar_bspstore; +return regs->r12; }static inline int is_syscall_success (struct pt_regs *regs)
@@ -79,11 +78,6 @@ static inline long regs_return_value(strunsigned long __ip =instruction_pointer (regs); \ (__ip & ~3UL ) + ((__ip &3UL ) <<2 ); \ }) -/* -* Why not default? Because user_stack_pointer() on ia64 gives register -* stack backing store instead... -*/ -#define current_user_stack_pointer () (current_pt_regs()->r12)/* given a pointer to a task_struct, return the user's pt_regs */ # define task_pt_regs (t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
_
Andrew Morton
maintainerPATCH 12/16 fs: direct-io: fix missing sdio->boundary
In reply to Andrew MortonFrom: Jack Qiu <[email protected]>
Subject: fs: direct-io: fix missing sdio->boundary
I encountered a hung task issue, but not a performance one. I run DIO on a device (need lba continuous, for example open channel ssd), maybe hungtask in below case:
DIO: Checkpoint:
get addr A(at boundary), merge into BIO,
no submit because boundary missing
flush dirty data(get addr A+1), wait IO(A+1) writeback timeout, because DIO(A) didn't submit
get addr A+2 fail, because checkpoint is doing
dio_send_cur_page() may clear sdio->boundary, so prevent it from missing a boundary.
added to it")
---
fs/direct-io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/direct-io.c renamed from fs/direct-io.c~fs-direct-io-fix-missing-sdio-boundary +3 -2
@@ -812,6 +812,7 @@ submit_page_section(struct dio *dio, str struct buffer_head *map_bh) {int ret =0 ; +int boundary = sdio->boundary;/* dio_send_cur_page may clear it */ if (dio->op ==REQ_OP_WRITE ) {/*
@@ -850,10 +851,10 @@ submit_page_section(struct dio *dio, str sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; out:/* -* If sdio->boundary then we want to schedule the IO now to +* If boundary then we want to schedule the IO now to * avoid metadata seeks. */ -if (sdio->boundary) { +if (boundary) { ret =dio_send_cur_page (dio, sdio, map_bh);if (sdio->bio)dio_bio_submit (dio, sdio);
_
Andrew Morton
maintainerPATCH 13/16 kasan: fix conflict with page poisoning
In reply to Andrew MortonFrom: Andrey Konovalov <[email protected]>
Subject: kasan: fix conflict with page poisoning
When page poisoning is enabled, it accesses memory that is marked as poisoned by KASAN, which leas to false-positive KASAN reports.
Suppress the reports by adding KASAN annotations to unpoison_page() (poison_page() already has them).
---
mm/page_poison.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/page_poison.c renamed from mm/page_poison.c~kasan-fix-conflict-with-page-poisoning +3 -1
@@ -77,12 +77,14 @@ static void unpoison_page(struct page *pvoid *addr; addr =kmap_atomic (page); +kasan_disable_current ();/* * Page poisoning when enabled poisons each and every page * that is freed to buddy. Thus no extra check is done to * see if a page was poisoned. */ -check_poison_mem (addr,PAGE_SIZE ); +check_poison_mem (kasan_reset_tag (addr),PAGE_SIZE ); +kasan_enable_current ();kunmap_atomic (addr); }
_
Andrew Morton
maintainerPATCH 14/16 lib/test_kasan_module.c: suppress unused var warning
In reply to Andrew MortonFrom: Andrew Morton <[email protected]>
Subject: lib/test_kasan_module.c: suppress unused var warning
Local `unused' is intentionally unused - it is there to suppress __must_check warnings.
---
lib/test_kasan_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_kasan_module.c renamed from lib/test_kasan_module.c~lib-test_kasan_modulec-suppress-unused-var-warning +1 -1
@@ -22,7 +22,7 @@ static noinline void __init copy_user_techar *kmem;char __user *usermem;size_t size =10 ; -int unused; +int __maybe_unused unused; kmem =kmalloc (size,GFP_KERNEL );if (!kmem)
_
Andrew Morton
maintainerPATCH 15/16 kfence, x86: fix preemptible warning on KPTI-enabled systems
In reply to Andrew MortonFrom: Marco Elver <[email protected]>
Subject: kfence, x86: fix preemptible warning on KPTI-enabled systems
On systems with KPTI enabled, we can currently observe the following warning:
BUG: using smp_processor_id() in preemptible caller is invalidate_user_asid+0x13/0x50 CPU: 6 PID: 1075 Comm: dmesg Not tainted 5.12.0-rc4-gda4a2b1a5479-kfence_1+ #1 Hardware name: Hewlett-Packard HP Pro 3500 Series/2ABF, BIOS 8.11 10/24/2012 Call Trace: dump_stack+0x7f/0xad check_preemption_disabled+0xc8/0xd0 invalidate_user_asid+0x13/0x50 flush_tlb_one_kernel+0x5/0x20 kfence_protect+0x56/0x80 ...
While it normally makes sense to require preemption to be off, so that the expected CPU's TLB is flushed and not another, in our case it really is best-effort (see comments in kfence_protect_page()).
Avoid the warning by disabling preemption around flush_tlb_one_kernel().
---
arch/x86/include/asm/kfence.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/include/asm/kfence.h renamed from arch/x86/include/asm/kfence.h~kfence-x86-fix-preemptible-warning-on-kpti-enabled-systems +6 -1
@@ -56,8 +56,13 @@ static inline bool kfence_protect_page(uelse set_pte (pte,__pte (pte_val (*pte) | _PAGE_PRESENT)); -/* Flush this CPU's TLB. */ +/* +* Flush this CPU's TLB, assuming whoever did the allocation/free is +* likely to continue running on this CPU. +*/ +preempt_disable ();flush_tlb_one_kernel (addr); +preempt_enable ();return true; }
_
Andrew Morton
maintainerPATCH 16/16 lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
In reply to Andrew MortonFrom: Julian Braha <[email protected]>
Subject: lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
When LATENCYTOP, LOCKDEP, or FAULT_INJECTION_STACKTRACE_FILTER is enabled and ARCH_WANT_FRAME_POINTERS is disabled, Kbuild gives a warning such as:
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on [n]: DEBUG_KERNEL [=y] && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS [=n] || MCOUNT [=n]
Selected by [y]:
- LATENCYTOP [=y] && DEBUG_KERNEL [=y] && STACKTRACE_SUPPORT [=y] && PROC_FS [=y] && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86
Depending on ARCH_WANT_FRAME_POINTERS causes a recursive dependency error. ARCH_WANT_FRAME_POINTERS is to be selected by the architecture, and is not supposed to be overridden by other config options.
---
lib/Kconfig.debug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~lib-fix-kconfig-dependency-on-arch_want_frame_pointers +3 -3
@@ -1363,7 +1363,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 select KALLSYMS select KALLSYMS_ALL
@@ -1665,7 +1665,7 @@ config LATENCYTOP depends on DEBUG_KERNEL depends on STACKTRACE_SUPPORT depends on PROC_FS - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 select KALLSYMS select KALLSYMS_ALL select STACKTRACE
@@ -1918,7 +1918,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 help Provide stacktrace filter for fault-injection capabilities
_