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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d2c27d72b9b2cbdb83d25165a20559a@kernel.org>
Date:   Mon, 22 Feb 2021 10:48:11 +0000
From:   Marc Zyngier <maz@...nel.org>
To:     Mark Rutland <mark.rutland@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        catalin.marinas@....com, james.morse@....com, marcan@...can.st,
        tglx@...utronix.de, will@...nel.org
Subject: Re: [PATCH 5/8] arm64: irq: add a default handle_irq panic function

On 2021-02-22 09:59, Mark Rutland wrote:
> On Fri, Feb 19, 2021 at 11:39:01AM +0000, Mark Rutland wrote:
>> If we accidentally unmask IRQs before we've registered an IRQ
>> controller, handle_arch_irq will be NULL, and the IRQ exception 
>> handler
>> will branch to a bogus address.
>> 
>> To make this easier to debug, this patch initialises handle_arch_irq 
>> to
>> a default handler which will panic(), making such problems easier to
>> debug. When we add support for FIQ handlers, we can follow the same
>> approach.
> 
>> -void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
>> +void default_handle_irq(struct pt_regs *regs)
>> +{
>> +	panic("IRQ taken without a registered IRQ controller\n");
>> +}
> 
> The kbuild test robot pointed out that this should be static (likewise
> with default_handle_fiq in patch 8), since it's only used within this
> file, so I've updated that in my branch.
> 
> Mark.
> 
>> +
>> +void (*handle_arch_irq)(struct pt_regs *) __ro_after_init = 
>> default_handle_irq;
>> 
>>  int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
>>  {
>> -	if (handle_arch_irq)
>> +	if (handle_arch_irq != default_handle_irq)
>>  		return -EBUSY;
>> 
>>  	handle_arch_irq = handle_irq;
>> @@ -87,7 +92,7 @@ void __init init_IRQ(void)
>>  	init_irq_stacks();
>>  	init_irq_scs();
>>  	irqchip_init();
>> -	if (!handle_arch_irq)
>> +	if (handle_arch_irq == default_handle_irq)
>>  		panic("No interrupt controller found.");

It also seems odd to have both default_handle_irq() that panics,
and init_IRQ that panics as well. Not a big deal, but maybe
we should just drop this altogether and get the firework on the
first interrupt.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ