lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a4f485b-51e7-47de-abe9-ede18e1e6643@yoseli.org>
Date: Tue, 5 Nov 2024 17:07:14 +0100
From: Jean-Michel Hautbois <jeanmichel.hautbois@...eli.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] m68k: Initialize jump labels early during setup_arch()

Hi Geert,

On 11/5/24 17:04, Geert Uytterhoeven wrote:
> Hi Jean-Michel,
> 
> On Tue, Nov 5, 2024 at 3:56 PM Jean-Michel Hautbois
> <jeanmichel.hautbois@...eli.org> wrote:
>> On 11/5/24 15:03, Geert Uytterhoeven wrote:
>>> On Wed, Oct 16, 2024 at 6:18 PM Jean-Michel Hautbois
>>> <jeanmichel.hautbois@...eli.org> wrote:
>>>> The jump_label_init() should be called from setup_arch() very
>>>> early for proper functioning of jump label support.
>>>>
>>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@...eli.org>
>>>
>>> Thanks for your patch!
>>>
>>>> --- a/arch/m68k/kernel/setup_mm.c
>>>> +++ b/arch/m68k/kernel/setup_mm.c
>>>> @@ -249,7 +249,11 @@ void __init setup_arch(char **cmdline_p)
>>>>           process_uboot_commandline(&m68k_command_line[0], CL_SIZE);
>>>>           *cmdline_p = m68k_command_line;
>>>>           memcpy(boot_command_line, *cmdline_p, CL_SIZE);
>>>> -
>>>> +       /*
>>>> +        * Initialise the static keys early as they may be enabled by the
>>>> +        * cpufeature code and early parameters.
>>>> +        */
>>>> +       jump_label_init();
>>>>           parse_early_param();
>>>>
>>>>           switch (m68k_machtype) {
>>>
>>> This is indeed what some (but not all) other architectures are doing, so
>>> Reviewed-by: Geert Uytterhoeven <geert@...ux-m68k.org>
>>>
>>> I assume you saw some "static key used before call to jump_label_init()"
>>> warning[1]? Since I never saw such a message, can you please elaborate
>>> and explain your use case, so I can add that to the patch description
>>> when applying?
>>
>> Indeed ! I saw this when I was passing the "threadirqs" parameter to the
>> kernel commandline and the "select IRQ_FORCED_THREADING" line to the
>> Kconfig.
> 
> Thanks, I can reproduce it using that method.
> 
>> I suspect this might be true for other keys.
> 
> Indeed. But m68k and its configs don't enable much code that uses keys.
> The only one I found was "thread_backlog_napi". Adding that to the
> kernel command line gives:
> 
>      WARNING: CPU: 0 PID: 0 at include/linux/jump_label.h:322
> setup_backlog_napi_threads+0x40/0xa0
>      static_key_enable(): static key '0x5ceec0' used before call to
> jump_label_init()
> 
> so I'll add that to the patch description.

Great news !

> 
>> BTW, threaded IRQs work fine ;-).
> 
> On Atari (ARAnyM), they blow up spectacularly:
> 
>      Unable to handle kernel NULL pointer dereference at virtual address 00000000
>      Oops: 00000000
>      Modules linked in:
>      PC: [<00040baa>] try_to_wake_up+0x90/0x1b8
>      SR: 2701  SP: (ptrval)  a2: 0055b660
>      d0: 00000003    d1: 00000003    d2: 00000000    d3: 00002700
>      d4: 00000008    d5: 00000000    a0: 00558000    a1: 00558000
>      Process swapper (pid: 0, task=(ptrval))
>      Frame format=7 eff addr=00000000 ssw=0505 faddr=00000000
>      wb 1 stat/addr/data: 0000 00000000 00000000
>      wb 2 stat/addr/data: 0000 00000000 00000000
>      wb 3 stat/addr/data: 0000 00000000 00000000
>      push data: 00000000 00000000 00000000 00000000
>      Stack from 00559ea8:
>      00000000 0000000f 00007874 01006140 00559ef0 00050ec6 0000000f 00559ed8
>      00040ce6 00000000 00000003 00000000 00559f14 0003b9b6 00000000 00000000
>      00592710 010040c0 00000000 00559ef4 00559ef4 0003ba26 00051cd2 010040c0
>      ffffffff 004fc9a1 00559f2c 00559ff8 00050ef8 00051cd2 010040c0 ffffffff
>      004fc9a1 0000000f 004f9268 00000000 00592710 010040c0 00051566 010040c0
>      0000000f 00000000 00000000 0000000f 00007874 00000000 010040c0 00592710
>      Call Trace: [<00007874>] stdma_int+0x0/0x1c
>       [<00050ec6>] setup_irq_thread+0x0/0x98
>       [<00040ce6>] wake_up_process+0x14/0x18
>       [<0003b9b6>] __kthread_create_on_node+0xca/0x11e
>       [<0003ba26>] kthread_create_on_node+0x1c/0x26
>       [<00051cd2>] irq_thread+0x0/0x184
>       [<00050ef8>] setup_irq_thread+0x32/0x98
>       [<00051cd2>] irq_thread+0x0/0x184
>       [<00051566>] __setup_irq+0x172/0x582
>       [<00007874>] stdma_int+0x0/0x1c
>       [<00051a34>] request_threaded_irq+0xbe/0x14e
>       [<0003ab86>] parse_args+0x0/0x202
>       [<0000556e>] m68k_setup_irq_controller+0x0/0x48
>       [<00255bda>] __is_suppressed_warning+0x0/0x42
>       [<005da080>] stdma_init+0x2a/0x42
>       [<00007874>] stdma_int+0x0/0x1c
>       [<00200080>] ksys_shmctl+0x420/0x5f8
>       [<00007874>] stdma_int+0x0/0x1c
>       [<005d9f82>] atari_init_IRQ+0xc0/0x194
>       [<00412cc8>] _printk+0x0/0x18
>       [<00255bda>] __is_suppressed_warning+0x0/0x42
>       [<005d62b0>] start_kernel+0x40e/0x618
>       [<005d5344>] _sinittext+0x344/0x9e8
> 
>      Code: 0008 5281 2341 0008 b6fc fc3c 6700 011e <2213> c280 6700
> 0108 202b 0018 4bf9 0004 05a6 6700 0096 486e fffc 2f0b 4eb9 0004
>      Disabling lock debugging due to kernel taint
>      Kernel panic - not syncing: Attempted to kill the idle task!
>      ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---

I needed to make my nfc driver (vf610_nfc) be hardirq though using 
IRQF_NO_THREAD but ethernet and all work fine on coldfire.

Thanks !
JM


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ