From c065d0615316754d324382c6b6879ac392510b13 Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sat, 1 Feb 2025 00:10:16 +0000 Subject: [PATCH 1/5] Revert "ANDROID: declare sp_in_global outside of CONFIG_FRAME_POINTER" This reverts commit 3818981c333235449aa71c20848b175571a0c1cb. Breaks 64-bit riscv builds in kernelci Bug: 393656515 Change-Id: Ia980771e1895e2360a7e9ec6eca8ff495123bdd7 Signed-off-by: Todd Kjos --- arch/riscv/kernel/stacktrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index aecbfd0b883a..7d145ae70416 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -12,8 +12,6 @@ #include #include -register unsigned long sp_in_global __asm__("sp"); - #ifdef CONFIG_FRAME_POINTER struct stackframe { @@ -21,6 +19,8 @@ struct stackframe { unsigned long ra; }; +register unsigned long sp_in_global __asm__("sp"); + void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg) { From 2c4041228e4e75347718d0b25bd3f730b63babb8 Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sat, 1 Feb 2025 00:10:28 +0000 Subject: [PATCH 2/5] Revert "BACKPORT: RISC-V: Stop relying on GCC's register allocator's hueristics" This reverts commit f06e9ec979554937a5526cf5ab759b1d6ba342f6. Breaks 64-bit riscv builds in kernelci Bug: 393656515 Change-Id: I3a4cf13f4ebde7d84f4d9b6f88729b7afb9735f7 Signed-off-by: Todd Kjos --- arch/riscv/include/asm/current.h | 5 ++--- arch/riscv/kernel/process.c | 5 ++--- arch/riscv/kernel/stacktrace.c | 7 +++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/riscv/include/asm/current.h b/arch/riscv/include/asm/current.h index f3d89c418638..44dcf7fc15ee 100644 --- a/arch/riscv/include/asm/current.h +++ b/arch/riscv/include/asm/current.h @@ -17,8 +17,6 @@ struct task_struct; -register struct task_struct *riscv_current_is_tp __asm__("tp"); - /* * This only works because "struct thread_info" is at offset 0 from "struct * task_struct". This constraint seems to be necessary on other architectures @@ -28,7 +26,8 @@ register struct task_struct *riscv_current_is_tp __asm__("tp"); */ static __always_inline struct task_struct *get_current(void) { - return riscv_current_is_tp; + register struct task_struct *tp __asm__("tp"); + return tp; } #define current get_current() diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index 652ba81e4fa2..9d4b4098874b 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -22,8 +22,6 @@ #include #include -unsigned long gp_in_global __asm__("gp"); - extern asmlinkage void ret_from_fork(void); extern asmlinkage void ret_from_kernel_thread(void); @@ -111,8 +109,9 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp, /* p->thread holds context to be restored by __switch_to() */ if (unlikely(p->flags & PF_KTHREAD)) { /* Kernel thread */ + const register unsigned long gp __asm__ ("gp"); memset(childregs, 0, sizeof(struct pt_regs)); - childregs->gp = gp_in_global; + childregs->gp = gp; childregs->sstatus = SR_SPP | SR_SPIE; /* Supervisor, irqs on */ p->thread.ra = (unsigned long)ret_from_kernel_thread; diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 7d145ae70416..5ba4d23971fd 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -19,8 +19,6 @@ struct stackframe { unsigned long ra; }; -register unsigned long sp_in_global __asm__("sp"); - void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg) { @@ -31,7 +29,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, sp = user_stack_pointer(regs); pc = instruction_pointer(regs); } else if (task == NULL || task == current) { - const register unsigned long current_sp = sp_in_global; + const register unsigned long current_sp __asm__ ("sp"); fp = (unsigned long)__builtin_frame_address(0); sp = current_sp; pc = (unsigned long)walk_stackframe; @@ -75,7 +73,8 @@ void notrace walk_stackframe(struct task_struct *task, sp = user_stack_pointer(regs); pc = instruction_pointer(regs); } else if (task == NULL || task == current) { - sp = sp_in_global; + const register unsigned long current_sp __asm__ ("sp"); + sp = current_sp; pc = (unsigned long)walk_stackframe; } else { /* task blocked in __switch_to */ From 26399219f0728df3fffca309fc050980b47373cb Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sat, 1 Feb 2025 00:16:54 +0000 Subject: [PATCH 3/5] ANDROID: kernelci build-break for 64-bit riscv clang builds (5.4 only) No 64-bit riscv builds were working with clang (found via kernelci) for our 5.4 kernels: ld.lld: error: arch/riscv/built-in.a(kernel/signal.o):(function do_notify_resume: .text+0x30c): relocation R_RISCV_PCREL_HI20 out of range: 33554406 is not in [-524288, 524287]; references '__vdso_rt_sigreturn' >>> referenced by signal.c >>> defined in arch/riscv/built-in.a(kernel/vdso/vdso-syms.o) There are two ANDROID-specific patches that added global variables that must be reverted to fix the build: f06e9ec97955 ("BACKPORT: RISC-V: Stop relying on GCC's register allocator's hueristics") 3818981c3332 ("ANDROID: declare sp_in_global outside of CONFIG_FRAME_POINTER") Also, CONFIG_INIT_STACK_ALL_PATTERN must be disabled to avoid the relocation issues. These issues all seem to be fixed in 5.10 and later kernels. Bug: 393656515 Signed-off-by: Todd Kjos Change-Id: I0a5395a9767b94ec2291c9ef7e9a69f1f4665730 --- security/Kconfig.hardening | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening index b54eb7177a31..f149bf4f8540 100644 --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -37,8 +37,8 @@ config CC_HAS_AUTO_VAR_INIT_ZERO choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS - default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN - default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO + default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN && !RISCV + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO && !RISCV default INIT_STACK_NONE help This option enables initialization of stack variables at From c1ccccc765f0e088c26aaab5b5f283d09a248185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 29 Jan 2025 13:24:18 -0800 Subject: [PATCH 4/5] ANDROID: gki - change networking configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the following configuration changes: CONFIG_NET_CLS_MATCHALL=y CONFIG_NET_ACT_POLICE=y CONFIG_NET_ACT_BPF=y CONFIG_USB_RTL8150=y CONFIG_USB_NET_CDC_EEM=y CONFIG_USB_NET_CDC_NCM=y CONFIG_USB_NET_AQC111=y Note: 4 of these are already enabled in android12-5.4, and the remaining 3 will be enabled as well in https://android-review.googlesource.com/c/kernel/common/+/3470489 Test: TreeHugger Bug: 377436524 Bug: 391669319 Signed-off-by: Maciej Żenczykowski Change-Id: I1737c1e18a072cac9dd50e4d21b52b220c2ec40c --- arch/arm64/configs/gki_defconfig | 7 ++++++- arch/x86/configs/gki_defconfig | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index f1aea345f539..8024a1dbfa28 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -210,9 +210,12 @@ CONFIG_NET_SCH_HTB=y CONFIG_NET_SCH_INGRESS=y CONFIG_NET_CLS_U32=y CONFIG_NET_CLS_BPF=y +CONFIG_NET_CLS_MATCHALL=y CONFIG_NET_EMATCH=y CONFIG_NET_EMATCH_U32=y CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=y +CONFIG_NET_ACT_BPF=y CONFIG_BPF_JIT=y CONFIG_BT=y CONFIG_BT_RFCOMM=y @@ -279,12 +282,14 @@ CONFIG_PPP_DEFLATE=y CONFIG_PPP_MPPE=y CONFIG_PPTP=y CONFIG_PPPOL2TP=y +CONFIG_USB_RTL8150=y CONFIG_USB_RTL8152=y CONFIG_USB_USBNET=y -# CONFIG_USB_NET_CDC_NCM is not set +CONFIG_USB_NET_CDC_EEM=y # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set +CONFIG_USB_NET_AQC111=y # CONFIG_WLAN_VENDOR_ADMTEK is not set # CONFIG_WLAN_VENDOR_ATH is not set # CONFIG_WLAN_VENDOR_ATMEL is not set diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig index 6d41f164bb2f..ac72f575b80a 100644 --- a/arch/x86/configs/gki_defconfig +++ b/arch/x86/configs/gki_defconfig @@ -188,9 +188,12 @@ CONFIG_NET_SCH_HTB=y CONFIG_NET_SCH_INGRESS=y CONFIG_NET_CLS_U32=y CONFIG_NET_CLS_BPF=y +CONFIG_NET_CLS_MATCHALL=y CONFIG_NET_EMATCH=y CONFIG_NET_EMATCH_U32=y CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=y +CONFIG_NET_ACT_BPF=y CONFIG_BPF_JIT=y CONFIG_BT=y CONFIG_BT_RFCOMM=y @@ -252,12 +255,14 @@ CONFIG_PPP_DEFLATE=y CONFIG_PPP_MPPE=y CONFIG_PPTP=y CONFIG_PPPOL2TP=y +CONFIG_USB_RTL8150=y CONFIG_USB_RTL8152=y CONFIG_USB_USBNET=y -# CONFIG_USB_NET_CDC_NCM is not set +CONFIG_USB_NET_CDC_EEM=y # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set +CONFIG_USB_NET_AQC111=y # CONFIG_WLAN_VENDOR_ADMTEK is not set # CONFIG_WLAN_VENDOR_ATH is not set # CONFIG_WLAN_VENDOR_ATMEL is not set From 0d3e5b23e533879d5c4c30fdb114738235c202a2 Mon Sep 17 00:00:00 2001 From: Terence Tritton Date: Tue, 18 Feb 2025 08:55:50 +0000 Subject: [PATCH 5/5] ANDROID: ABI: Cuttlefish Symbol update android11-5.4 is broken on Cuttlefish aarch64 because of the use of blk_mq_quiesce_queue_nowait in virtio_blk.ko. The following steps were used to update the cuttlefish symbol list. $ BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh $ BUILD_CONFIG=common-modules/virtual-\ device/build.config.cuttlefish.aarch64 build/build.sh $ build/abi/extract_symbols out/android11-5.4/dist/ --whitelist \ common/android/abi_gki_aarch64_cuttlefish --additions-only $ BUILD_CONFIG=common/build.config.gki.aarch64 build/build_abi.sh \ --update --print-report Change-Id: I01fac6926d4362c00cbd212091ab7d4fa98b885c Bug: 391465004 Signed-off-by: Terry Tritton --- android/abi_gki_aarch64.xml | 13 +++++++++++++ android/abi_gki_aarch64_cuttlefish | 18 +++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index def41776bbaf..0e48c4e84df9 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -426,6 +426,7 @@ + @@ -37447,6 +37448,10 @@ + + + + @@ -149383,6 +149388,14 @@ + + + + + + + + diff --git a/android/abi_gki_aarch64_cuttlefish b/android/abi_gki_aarch64_cuttlefish index c2732aa7dba0..6d6db2054797 100644 --- a/android/abi_gki_aarch64_cuttlefish +++ b/android/abi_gki_aarch64_cuttlefish @@ -230,7 +230,6 @@ vring_del_virtqueue vring_interrupt vring_transport_features - wait_for_completion wait_woken __wake_up __warn_printk @@ -739,11 +738,13 @@ blk_mq_complete_request blk_mq_end_request blk_mq_free_tag_set + blk_mq_freeze_queue blk_mq_init_queue - blk_mq_quiesce_queue + blk_mq_quiesce_queue_nowait blk_mq_start_request blk_mq_start_stopped_hw_queues blk_mq_stop_hw_queue + blk_mq_unfreeze_queue blk_mq_unquiesce_queue blk_mq_virtio_map_queues blk_put_request @@ -800,6 +801,7 @@ __splice_from_pipe system_freezing_cnt __unregister_chrdev + wait_for_completion # required by virtio_input.ko input_alloc_absinfo @@ -813,14 +815,10 @@ # required by virtio_mmio.ko device_for_each_child - devm_ioremap - devm_kfree - __devm_request_region - iomem_resource + devm_platform_ioremap_resource memparse platform_device_register_full platform_get_irq - platform_get_resource sscanf # required by virtio_net.ko @@ -956,6 +954,12 @@ sock_i_ino # preserved by --additions-only + blk_mq_quiesce_queue + devm_ioremap + devm_kfree + __devm_request_region generic_shutdown_super + iomem_resource + platform_get_resource refcount_dec_and_test_checked refcount_inc_checked