Re: [PATCH v11 00/11] Support page table check PowerPC

Christophe Leroy
2024-03-28T07:57:20Z

Le 28/03/2024 à 07:52, Christophe Leroy a écrit :
>
>
> Le 28/03/2024 à 05:55, Rohan McLure a écrit :
>> Support page table check on all PowerPC platforms. This works by
>> serialising assignments, reassignments and clears of page table
>> entries at each level in order to ensure that anonymous mappings
>> have at most one writable consumer, and likewise that file-backed
>> mappings are not simultaneously also anonymous mappings.
>>
>> In order to support this infrastructure, a number of stubs must be
>> defined for all powerpc platforms. Additionally, seperate set_pte_at()
>> and set_pte_at_unchecked(), to allow for internal, uninstrumented
>> mappings.
>
> I gave it a try on QEMU e500 (64 bits), and get the following Oops. What
> do I have to look for ?
>
> Freeing unused kernel image (initmem) memory: 2588K
> This architecture does not have kernel memory protection.
> Run /init as init process
> ------------[ cut here ]------------
> kernel BUG at mm/page_table_check.c:119!
> Oops: Exception in kernel mode, sig: 5 [#1]
> BE PAGE_SIZE=4K SMP NR_CPUS=32 QEMU e500

Same problem on my 8xx board:

[ 7.358146] Freeing unused kernel image (initmem) memory: 448K
[ 7.363957] Run /init as init process
[ 7.370955] ------------[ cut here ]------------
[ 7.375411] kernel BUG at mm/page_table_check.c:119!
[ 7.380393] Oops: Exception in kernel mode, sig: 5 [#1]
[ 7.385621] BE PAGE_SIZE=16K PREEMPT CMPC885
[ 7.393483] CPU: 0 PID: 1 Comm: init Not tainted
6.8.0-s3k-dev-13737-g8d9e247585fb #787
[ 7.401505] Hardware name: MIAE 8xx 0x500000 CMPC885
[ 7.406481] NIP: c0183278 LR: c018316c CTR: 00000001
[ 7.411541] REGS: c902bb20 TRAP: 0700 Not tainted
(6.8.0-s3k-dev-13737-g8d9e247585fb)
[ 7.419657] MSR: 00029032 <EE,ME,IR,DR,RI> CR: 35055355 XER: 80007100
[ 7.426550]
[ 7.426550] GPR00: c018316c c902bbe0 c2118000 c7f7a0d8 7fab8000
c23b5ae0 c902bc20 00000002
[ 7.426550] GPR08: c11a0000 c7f7a0d8 c11143e0 00000000 95003355
00000000 c0004a38 c23a0a00
[ 7.426550] GPR16: 00004000 7fffc000 80000000 c23a0a00 00000001
7fab8000 ffabc000 80000000
[ 7.426550] GPR24: 7fffc000 c33be1c0 00004000 c902bc20 7fab8000
00000001 c7fb0360 00000000
[ 7.463291] NIP [c0183278] __page_table_check_ptes_set+0x1c8/0x210
[ 7.469491] LR [c018316c] __page_table_check_ptes_set+0xbc/0x210
[ 7.475514] Call Trace:
[ 7.477957] [c902bbe0] [c018316c]
__page_table_check_ptes_set+0xbc/0x210 (unreliable)
[ 7.485809] [c902bc00] [c0012474] set_ptes+0x148/0x16c
[ 7.490958] [c902bc50] [c0158a3c] move_page_tables+0x228/0x578
[ 7.496806] [c902bcf0] [c0192f38] shift_arg_pages+0xf0/0x1d4
[ 7.502479] [c902bd90] [c0193b40] setup_arg_pages+0x1c8/0x36c
[ 7.508238] [c902be40] [c01f51a0] load_elf_binary+0x3c0/0x1218
[ 7.514086] [c902beb0] [c01934b0] bprm_execve+0x21c/0x4a4
[ 7.519497] [c902bf00] [c019516c] kernel_execve+0x13c/0x200
[ 7.525082] [c902bf20] [c0004aa8] kernel_init+0x70/0x1b0
[ 7.530406] [c902bf30] [c00111e4] ret_from_kernel_user_thread+0x10/0x18
[ 7.537038] --- interrupt: 0 at 0x0
[ 7.540534] Code: 39290004 7ce04828 30e70001 7ce0492d 40a2fff4
2c070000 4080ff94 0fe00000 0fe00000 0fe00000 2c1f0000 4082ff80
<0fe00000> 0fe00000 392affff 4bfffef8
[ 7.556068] ---[ end trace 0000000000000000 ]---
[ 7.560692]
[ 8.531997] note: init[1] exited with irqs disabled
[ 8.536891] note: init[1] exited with preempt_count 1
[ 8.542032] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000005
[ 8.549602] Rebooting in 180 seconds..