Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
@ 2026-01-14  1:37 zhaoyang.huang
  2026-01-14  2:14 ` Zhaoyang Huang
  0 siblings, 1 reply; 6+ messages in thread
From: zhaoyang.huang @ 2026-01-14  1:37 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel,
	Zhaoyang Huang, steve.kang
  Cc: jeson.gao, xuewen.yan

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

A DABT is reported[1] on an android based system when resume from hiberate,
which is root caused as CFI will plant stub code[2] to verify the
swsusp_arch_suspend_exit's authentication, where the hash value is stored
before the page that alloced by create_safe_exec_page. We also have
tried to copy the hash value together with the function but get failed since
the value is not on the desired position(src_start - 4). So we solve
this issue by setting __nocfi on swsusp_arch_resume and it works.

[1]
[   22.991934][    T1] Unable to handle kernel paging request at virtual address 0000000109170ffc
[   22.991934][    T1] Mem abort info:
[   22.991934][    T1]   ESR = 0x0000000096000007
[   22.991934][    T1]   EC = 0x25: DABT (current EL), IL = 32 bits
[   22.991934][    T1]   SET = 0, FnV = 0
[   22.991934][    T1]   EA = 0, S1PTW = 0
[   22.991934][    T1]   FSC = 0x07: level 3 translation fault
[   22.991934][    T1] Data abort info:
[   22.991934][    T1]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[   22.991934][    T1]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   22.991934][    T1]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   22.991934][    T1] [0000000109170ffc] user address but active_mm is swapper
[   22.991934][    T1] Internal error: Oops: 0000000096000007 [#1] PREEMPT SMP
[   22.991934][    T1] Dumping ftrace buffer:
[   22.991934][    T1]    (ftrace buffer empty)
[   22.991934][    T1] Modules linked in:
[   22.991934][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.98-android15-8-g0b1d2aee7fc3-dirty-4k #1 688c7060a825a3ac418fe53881730b355915a419
[   22.991934][    T1] Hardware name: Unisoc UMS9360-base Board (DT)
[   22.991934][    T1] pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   22.991934][    T1] pc : swsusp_arch_resume+0x2ac/0x344
[   22.991934][    T1] lr : swsusp_arch_resume+0x294/0x344
[   22.991934][    T1] sp : ffffffc08006b960
[   22.991934][    T1] x29: ffffffc08006b9c0 x28: 0000000000000000 x27: 0000000000000000
[   22.991934][    T1] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000820
[   22.991934][    T1] x23: ffffffd0817e3000 x22: ffffffd0817e3000 x21: 0000000000000000
[   22.991934][    T1] x20: ffffff8089171000 x19: ffffffd08252c8c8 x18: ffffffc080061058
[   22.991934][    T1] x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 0000000000000004
[   22.991934][    T1] x14: ffffff8178c88000 x13: 0000000000000006 x12: 0000000000000000
[   22.991934][    T1] x11: 0000000000000015 x10: 0000000000000001 x9 : ffffffd082533000
[   22.991934][    T1] x8 : 0000000109171000 x7 : 205b5d3433393139 x6 : 392e32322020205b
[   22.991934][    T1] x5 : 000000010916f000 x4 : 000000008164b000 x3 : ffffff808a4e0530
[   22.991934][    T1] x2 : ffffffd08058e784 x1 : 0000000082326000 x0 : 000000010a283000
[   22.991934][    T1] Call trace:
[   22.991934][    T1]  swsusp_arch_resume+0x2ac/0x344
[   22.991934][    T1]  hibernation_restore+0x158/0x18c
[   22.991934][    T1]  load_image_and_restore+0xb0/0xec
[   22.991934][    T1]  software_resume+0xf4/0x19c
[   22.991934][    T1]  software_resume_initcall+0x34/0x78
[   22.991934][    T1]  do_one_initcall+0xe8/0x370
[   22.991934][    T1]  do_initcall_level+0xc8/0x19c
[   22.991934][    T1]  do_initcalls+0x70/0xc0
[   22.991934][    T1]  do_basic_setup+0x1c/0x28
[   22.991934][    T1]  kernel_init_freeable+0xe0/0x148
[   22.991934][    T1]  kernel_init+0x20/0x1a8
[   22.991934][    T1]  ret_from_fork+0x10/0x20
[   22.991934][    T1] Code: a9400a61 f94013e0 f9438923 f9400a64 (b85fc110)

[2]
0xffffffd08064a878 <swsusp_arch_resume+596>:	mov	x0, x24
0xffffffd08064a87c <swsusp_arch_resume+600>:	mov	x1, x20
0xffffffd08064a880 <swsusp_arch_resume+604>:	mov	x2, x21
0xffffffd08064a884 <swsusp_arch_resume+608>:	mov	x3, x22
0xffffffd08064a888 <swsusp_arch_resume+612>:	mov	x4, x23
0xffffffd08064a88c <swsusp_arch_resume+616>:	ldur	w16, [x25, #-4]
0xffffffd08064a890 <swsusp_arch_resume+620>:	movk	w17, #0x5d7b
0xffffffd08064a894 <swsusp_arch_resume+624>:	movk	w17, #0xb6ad, lsl #16
0xffffffd08064a898 <swsusp_arch_resume+628>:	cmp	w16, w17
0xffffffd08064a89c <swsusp_arch_resume+632>:	b.eq	0xffffffd08064a8a4 <swsusp_arch_resume+640>  // b.none
0xffffffd08064a8a0 <swsusp_arch_resume+636>:	brk	#0x8239
0xffffffd08064a8a4 <swsusp_arch_resume+640>:	blr	x25

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 arch/arm64/kernel/hibernate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 18749e9a6c2d..9717568518ba 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -402,7 +402,7 @@ int swsusp_arch_suspend(void)
  * Memory allocated by get_safe_page() will be dealt with by the hibernate code,
  * we don't need to free it here.
  */
-int swsusp_arch_resume(void)
+int __nocfi swsusp_arch_resume(void)
 {
 	int rc;
 	void *zero_page;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
  2026-01-14  1:37 zhaoyang.huang
@ 2026-01-14  2:14 ` Zhaoyang Huang
  0 siblings, 0 replies; 6+ messages in thread
From: Zhaoyang Huang @ 2026-01-14  2:14 UTC (permalink / raw)
  To: zhaoyang.huang, James Morse
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel,
	steve.kang, jeson.gao, xuewen.yan

loop James Morse

On Wed, Jan 14, 2026 at 9:38 AM zhaoyang.huang
<zhaoyang.huang@unisoc.com> wrote:
>
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> A DABT is reported[1] on an android based system when resume from hiberate,
> which is root caused as CFI will plant stub code[2] to verify the
> swsusp_arch_suspend_exit's authentication, where the hash value is stored
> before the page that alloced by create_safe_exec_page. We also have
> tried to copy the hash value together with the function but get failed since
> the value is not on the desired position(src_start - 4). So we solve
> this issue by setting __nocfi on swsusp_arch_resume and it works.
>
> [1]
> [   22.991934][    T1] Unable to handle kernel paging request at virtual address 0000000109170ffc
> [   22.991934][    T1] Mem abort info:
> [   22.991934][    T1]   ESR = 0x0000000096000007
> [   22.991934][    T1]   EC = 0x25: DABT (current EL), IL = 32 bits
> [   22.991934][    T1]   SET = 0, FnV = 0
> [   22.991934][    T1]   EA = 0, S1PTW = 0
> [   22.991934][    T1]   FSC = 0x07: level 3 translation fault
> [   22.991934][    T1] Data abort info:
> [   22.991934][    T1]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
> [   22.991934][    T1]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> [   22.991934][    T1]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> [   22.991934][    T1] [0000000109170ffc] user address but active_mm is swapper
> [   22.991934][    T1] Internal error: Oops: 0000000096000007 [#1] PREEMPT SMP
> [   22.991934][    T1] Dumping ftrace buffer:
> [   22.991934][    T1]    (ftrace buffer empty)
> [   22.991934][    T1] Modules linked in:
> [   22.991934][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.98-android15-8-g0b1d2aee7fc3-dirty-4k #1 688c7060a825a3ac418fe53881730b355915a419
> [   22.991934][    T1] Hardware name: Unisoc UMS9360-base Board (DT)
> [   22.991934][    T1] pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [   22.991934][    T1] pc : swsusp_arch_resume+0x2ac/0x344
> [   22.991934][    T1] lr : swsusp_arch_resume+0x294/0x344
> [   22.991934][    T1] sp : ffffffc08006b960
> [   22.991934][    T1] x29: ffffffc08006b9c0 x28: 0000000000000000 x27: 0000000000000000
> [   22.991934][    T1] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000820
> [   22.991934][    T1] x23: ffffffd0817e3000 x22: ffffffd0817e3000 x21: 0000000000000000
> [   22.991934][    T1] x20: ffffff8089171000 x19: ffffffd08252c8c8 x18: ffffffc080061058
> [   22.991934][    T1] x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 0000000000000004
> [   22.991934][    T1] x14: ffffff8178c88000 x13: 0000000000000006 x12: 0000000000000000
> [   22.991934][    T1] x11: 0000000000000015 x10: 0000000000000001 x9 : ffffffd082533000
> [   22.991934][    T1] x8 : 0000000109171000 x7 : 205b5d3433393139 x6 : 392e32322020205b
> [   22.991934][    T1] x5 : 000000010916f000 x4 : 000000008164b000 x3 : ffffff808a4e0530
> [   22.991934][    T1] x2 : ffffffd08058e784 x1 : 0000000082326000 x0 : 000000010a283000
> [   22.991934][    T1] Call trace:
> [   22.991934][    T1]  swsusp_arch_resume+0x2ac/0x344
> [   22.991934][    T1]  hibernation_restore+0x158/0x18c
> [   22.991934][    T1]  load_image_and_restore+0xb0/0xec
> [   22.991934][    T1]  software_resume+0xf4/0x19c
> [   22.991934][    T1]  software_resume_initcall+0x34/0x78
> [   22.991934][    T1]  do_one_initcall+0xe8/0x370
> [   22.991934][    T1]  do_initcall_level+0xc8/0x19c
> [   22.991934][    T1]  do_initcalls+0x70/0xc0
> [   22.991934][    T1]  do_basic_setup+0x1c/0x28
> [   22.991934][    T1]  kernel_init_freeable+0xe0/0x148
> [   22.991934][    T1]  kernel_init+0x20/0x1a8
> [   22.991934][    T1]  ret_from_fork+0x10/0x20
> [   22.991934][    T1] Code: a9400a61 f94013e0 f9438923 f9400a64 (b85fc110)
>
> [2]
> 0xffffffd08064a878 <swsusp_arch_resume+596>:    mov     x0, x24
> 0xffffffd08064a87c <swsusp_arch_resume+600>:    mov     x1, x20
> 0xffffffd08064a880 <swsusp_arch_resume+604>:    mov     x2, x21
> 0xffffffd08064a884 <swsusp_arch_resume+608>:    mov     x3, x22
> 0xffffffd08064a888 <swsusp_arch_resume+612>:    mov     x4, x23
> 0xffffffd08064a88c <swsusp_arch_resume+616>:    ldur    w16, [x25, #-4]
> 0xffffffd08064a890 <swsusp_arch_resume+620>:    movk    w17, #0x5d7b
> 0xffffffd08064a894 <swsusp_arch_resume+624>:    movk    w17, #0xb6ad, lsl #16
> 0xffffffd08064a898 <swsusp_arch_resume+628>:    cmp     w16, w17
> 0xffffffd08064a89c <swsusp_arch_resume+632>:    b.eq    0xffffffd08064a8a4 <swsusp_arch_resume+640>  // b.none
> 0xffffffd08064a8a0 <swsusp_arch_resume+636>:    brk     #0x8239
> 0xffffffd08064a8a4 <swsusp_arch_resume+640>:    blr     x25
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
>  arch/arm64/kernel/hibernate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
> index 18749e9a6c2d..9717568518ba 100644
> --- a/arch/arm64/kernel/hibernate.c
> +++ b/arch/arm64/kernel/hibernate.c
> @@ -402,7 +402,7 @@ int swsusp_arch_suspend(void)
>   * Memory allocated by get_safe_page() will be dealt with by the hibernate code,
>   * we don't need to free it here.
>   */
> -int swsusp_arch_resume(void)
> +int __nocfi swsusp_arch_resume(void)
>  {
>         int rc;
>         void *zero_page;
> --
> 2.25.1
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
@ 2026-01-22 11:49 zhaoyang.huang
  2026-01-22 12:25 ` Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zhaoyang.huang @ 2026-01-22 11:49 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, James Morse, linux-arm-kernel,
	linux-kernel, Zhaoyang Huang, steve.kang
  Cc: jeson.gao, xuewen.yan

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

A DABT is reported[1] on an android based system when resume from hiberate,
which is root caused as CFI will plant stub code[2] to verify the
swsusp_arch_suspend_exit's authentication, where the hash value is stored
before the page that alloced by create_safe_exec_page. We also have
tried to copy the hash value together with the function but get failed since
the value is not on the desired position(src_start - 4). So we solve
this issue by setting __nocfi on swsusp_arch_resume and it works.

[1]
[   22.991934][    T1] Unable to handle kernel paging request at virtual address 0000000109170ffc
[   22.991934][    T1] Mem abort info:
[   22.991934][    T1]   ESR = 0x0000000096000007
[   22.991934][    T1]   EC = 0x25: DABT (current EL), IL = 32 bits
[   22.991934][    T1]   SET = 0, FnV = 0
[   22.991934][    T1]   EA = 0, S1PTW = 0
[   22.991934][    T1]   FSC = 0x07: level 3 translation fault
[   22.991934][    T1] Data abort info:
[   22.991934][    T1]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[   22.991934][    T1]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   22.991934][    T1]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   22.991934][    T1] [0000000109170ffc] user address but active_mm is swapper
[   22.991934][    T1] Internal error: Oops: 0000000096000007 [#1] PREEMPT SMP
[   22.991934][    T1] Dumping ftrace buffer:
[   22.991934][    T1]    (ftrace buffer empty)
[   22.991934][    T1] Modules linked in:
[   22.991934][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.98-android15-8-g0b1d2aee7fc3-dirty-4k #1 688c7060a825a3ac418fe53881730b355915a419
[   22.991934][    T1] Hardware name: Unisoc UMS9360-base Board (DT)
[   22.991934][    T1] pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   22.991934][    T1] pc : swsusp_arch_resume+0x2ac/0x344
[   22.991934][    T1] lr : swsusp_arch_resume+0x294/0x344
[   22.991934][    T1] sp : ffffffc08006b960
[   22.991934][    T1] x29: ffffffc08006b9c0 x28: 0000000000000000 x27: 0000000000000000
[   22.991934][    T1] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000820
[   22.991934][    T1] x23: ffffffd0817e3000 x22: ffffffd0817e3000 x21: 0000000000000000
[   22.991934][    T1] x20: ffffff8089171000 x19: ffffffd08252c8c8 x18: ffffffc080061058
[   22.991934][    T1] x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 0000000000000004
[   22.991934][    T1] x14: ffffff8178c88000 x13: 0000000000000006 x12: 0000000000000000
[   22.991934][    T1] x11: 0000000000000015 x10: 0000000000000001 x9 : ffffffd082533000
[   22.991934][    T1] x8 : 0000000109171000 x7 : 205b5d3433393139 x6 : 392e32322020205b
[   22.991934][    T1] x5 : 000000010916f000 x4 : 000000008164b000 x3 : ffffff808a4e0530
[   22.991934][    T1] x2 : ffffffd08058e784 x1 : 0000000082326000 x0 : 000000010a283000
[   22.991934][    T1] Call trace:
[   22.991934][    T1]  swsusp_arch_resume+0x2ac/0x344
[   22.991934][    T1]  hibernation_restore+0x158/0x18c
[   22.991934][    T1]  load_image_and_restore+0xb0/0xec
[   22.991934][    T1]  software_resume+0xf4/0x19c
[   22.991934][    T1]  software_resume_initcall+0x34/0x78
[   22.991934][    T1]  do_one_initcall+0xe8/0x370
[   22.991934][    T1]  do_initcall_level+0xc8/0x19c
[   22.991934][    T1]  do_initcalls+0x70/0xc0
[   22.991934][    T1]  do_basic_setup+0x1c/0x28
[   22.991934][    T1]  kernel_init_freeable+0xe0/0x148
[   22.991934][    T1]  kernel_init+0x20/0x1a8
[   22.991934][    T1]  ret_from_fork+0x10/0x20
[   22.991934][    T1] Code: a9400a61 f94013e0 f9438923 f9400a64 (b85fc110)

[2]
0xffffffd08064a878 <swsusp_arch_resume+596>:	mov	x0, x24
0xffffffd08064a87c <swsusp_arch_resume+600>:	mov	x1, x20
0xffffffd08064a880 <swsusp_arch_resume+604>:	mov	x2, x21
0xffffffd08064a884 <swsusp_arch_resume+608>:	mov	x3, x22
0xffffffd08064a888 <swsusp_arch_resume+612>:	mov	x4, x23
0xffffffd08064a88c <swsusp_arch_resume+616>:	ldur	w16, [x25, #-4]
0xffffffd08064a890 <swsusp_arch_resume+620>:	movk	w17, #0x5d7b
0xffffffd08064a894 <swsusp_arch_resume+624>:	movk	w17, #0xb6ad, lsl #16
0xffffffd08064a898 <swsusp_arch_resume+628>:	cmp	w16, w17
0xffffffd08064a89c <swsusp_arch_resume+632>:	b.eq	0xffffffd08064a8a4 <swsusp_arch_resume+640>  // b.none
0xffffffd08064a8a0 <swsusp_arch_resume+636>:	brk	#0x8239
0xffffffd08064a8a4 <swsusp_arch_resume+640>:	blr	x25

Co-developed-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 arch/arm64/kernel/hibernate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 18749e9a6c2d..9717568518ba 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -402,7 +402,7 @@ int swsusp_arch_suspend(void)
  * Memory allocated by get_safe_page() will be dealt with by the hibernate code,
  * we don't need to free it here.
  */
-int swsusp_arch_resume(void)
+int __nocfi swsusp_arch_resume(void)
 {
 	int rc;
 	void *zero_page;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
  2026-01-22 11:49 [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume zhaoyang.huang
@ 2026-01-22 12:25 ` Will Deacon
  2026-01-22 18:23 ` Catalin Marinas
  2026-01-23 15:55 ` Mark Rutland
  2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2026-01-22 12:25 UTC (permalink / raw)
  To: zhaoyang.huang
  Cc: Catalin Marinas, James Morse, linux-arm-kernel, linux-kernel,
	Zhaoyang Huang, steve.kang, jeson.gao, xuewen.yan

On Thu, Jan 22, 2026 at 07:49:25PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> A DABT is reported[1] on an android based system when resume from hiberate,
> which is root caused as CFI will plant stub code[2] to verify the
> swsusp_arch_suspend_exit's authentication, where the hash value is stored
> before the page that alloced by create_safe_exec_page. We also have
> tried to copy the hash value together with the function but get failed since
> the value is not on the desired position(src_start - 4). So we solve
> this issue by setting __nocfi on swsusp_arch_resume and it works.

Acked-by: Will Deacon <will@kernel.org>

Will


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
  2026-01-22 11:49 [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume zhaoyang.huang
  2026-01-22 12:25 ` Will Deacon
@ 2026-01-22 18:23 ` Catalin Marinas
  2026-01-23 15:55 ` Mark Rutland
  2 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2026-01-22 18:23 UTC (permalink / raw)
  To: Will Deacon, James Morse, linux-arm-kernel, linux-kernel,
	Zhaoyang Huang, steve.kang, zhaoyang.huang
  Cc: jeson.gao, xuewen.yan

On Thu, 22 Jan 2026 19:49:25 +0800, zhaoyang.huang wrote:
> A DABT is reported[1] on an android based system when resume from hiberate,
> which is root caused as CFI will plant stub code[2] to verify the
> swsusp_arch_suspend_exit's authentication, where the hash value is stored
> before the page that alloced by create_safe_exec_page. We also have
> tried to copy the hash value together with the function but get failed since
> the value is not on the desired position(src_start - 4). So we solve
> this issue by setting __nocfi on swsusp_arch_resume and it works.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arch: arm64: set __nocfi on swsusp_arch_resume
      (no commit info)

-- 
Catalin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
  2026-01-22 11:49 [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume zhaoyang.huang
  2026-01-22 12:25 ` Will Deacon
  2026-01-22 18:23 ` Catalin Marinas
@ 2026-01-23 15:55 ` Mark Rutland
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2026-01-23 15:55 UTC (permalink / raw)
  To: zhaoyang.huang
  Cc: Catalin Marinas, Will Deacon, James Morse, linux-arm-kernel,
	linux-kernel, Zhaoyang Huang, steve.kang, jeson.gao, xuewen.yan

On Thu, Jan 22, 2026 at 07:49:25PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> A DABT is reported[1] on an android based system when resume from hiberate,
> which is root caused as CFI will plant stub code[2] to verify the
> swsusp_arch_suspend_exit's authentication, where the hash value is stored
> before the page that alloced by create_safe_exec_page. We also have
> tried to copy the hash value together with the function but get failed since
> the value is not on the desired position(src_start - 4). So we solve
> this issue by setting __nocfi on swsusp_arch_resume and it works.

I think this patch is fine for now, but in case anyone is looking into
this in future, the description isn't quite right.

The problem is that swsusp_arch_suspend_exit() doesn't have a CFI hash
at all, even before it is copied, since it is marked with SYM_CODE_*().
There is no hash to copy.

Ideally we'd mark swsusp_arch_suspend_exit() with SYM_FUNC_*(), but
that'd break the expectation that the entrypoint to
swsusp_arch_suspend_exit() is the first byte of the .hibernate_exit.text
section. Changing that is a bigger job.

AFAICT there isn't a way to suppress KCFI checks for a specific function
call, so for now this'll have to do.

Mark.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-23 15:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 11:49 [PATCH] arch: arm64: set __nocfi on swsusp_arch_resume zhaoyang.huang
2026-01-22 12:25 ` Will Deacon
2026-01-22 18:23 ` Catalin Marinas
2026-01-23 15:55 ` Mark Rutland
  -- strict thread matches above, loose matches on Subject: below --
2026-01-14  1:37 zhaoyang.huang
2026-01-14  2:14 ` Zhaoyang Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox