Re: [PATCH] powerpc/64: Fix kernel stack 16-byte alignment
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-11-16 12:50:58
Sandipan Das [off-list ref] writes:
On 15/11/18 8:04 AM, Nicholas Piggin wrote:quoted
Commit 4c2de74cc869 ("powerpc/64: Interrupts save PPR on stack rather than thread_struct") changed sizeof(struct pt_regs) % 16 from 0 to 8, which causes the interrupt frame allocation on kernel entry to put the kernel stack out of alignment. Add a pad field to fix alignment, and add a BUILD_BUG_ON to catch this in future. Fixes: 4c2de74cc869 ("powerpc/64: Interrupts save PPR on stack rather than thread_struct") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [...]Thanks for fixing this. Commit 4c2de74cc869 ("powerpc/64: Interrupts save PPR on stack rather than thread_struct") was also leading to incorrect kernel stack traces.
OK thanks. In future if you see something weird like that please report it to the list. cheers
E.g.
If you are using `perf record -g` and expect to see a stack trace like this:
c0000000002b19a0 bpf_check+0x1910 (/usr/lib/debug/lib/modules/4.18.17-200.fc28.ppc64le/vmlinux)
c0000000002a5554 bpf_prog_load+0x684 (/usr/lib/debug/lib/modules/4.18.17-200.fc28.ppc64le/vmlinux)
c0000000002a6938 sys_bpf+0xaf8 (/usr/lib/debug/lib/modules/4.18.17-200.fc28.ppc64le/vmlinux)
c00000000000b9e4 system_call+0x5c (/usr/lib/debug/lib/modules/4.18.17-200.fc28.ppc64le/vmlinux)
7fff815bca90 syscall+0x50 (/usr/lib64/libc-2.27.so)
7fff7d96ee0c bpf_prog_load+0x16c (/usr/lib64/libbcc.so.0.7.0)
[...]
you would instead see something like this:
c0000000002bdb88 bpf_check+0xb88 (/lib/modules/4.20.0-rc1+/build/vmlinux)
c0000000002bdb60 bpf_check+0xb60 (/lib/modules/4.20.0-rc1+/build/vmlinux)
3fff8f350a90 syscall+0x50 (/usr/lib64/libc-2.27.so)
3fff8b788e0c bpf_prog_load+0x16c (/usr/lib64/libbcc.so.0.7.0)
[...]
--
With Regards,
Sandipan