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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 09 Feb 2013 20:02:38 +0000
From:	Matt Fleming <matt@...sole-pimps.org>
To:	Seiji Aguchi <seiji.aguchi@....com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
	"Luck, Tony (tony.luck@...el.com)" <tony.luck@...el.com>,
	"mikew@...gle.com" <mikew@...gle.com>,
	"cbouatmailru@...il.com" <cbouatmailru@...il.com>,
	"dzickus@...hat.com" <dzickus@...hat.com>,
	"dle-develop@...ts.sourceforge.net" 
	<dle-develop@...ts.sourceforge.net>,
	Satoru Moriya <satoru.moriya@....com>
Subject: Re: [PATCH v5 -next 1/2]efivars: Disable external interrupt while
 holding efivars->lock

On Thu, 2013-01-24 at 00:41 +0000, Seiji Aguchi wrote:
> [Problem]
> There is a scenario which efi_pstore fails to log messages in a panic case.
> 
>  - CPUA holds an efi_var->lock in either efivarfs parts 
>    or efi_pstore with interrupt enabled.
>  - CPUB panics and sends IPI to CPUA in smp_send_stop().
>  - CPUA stops with holding the lock.
>  - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
>    but it returns without logging messages.
> 
> [Patch Description]
> This patch disables an external interruption while holding efivars->lock 
> as follows.
> 
> In efi_pstore_write() and get_var_data(), spin_lock/spin_unlock is 
> replaced by spin_lock_irqsave/spin_unlock_irqrestore because they may 
> be called in an interrupt context.
> 
> In other functions, they are replaced by spin_lock_irq/spin_unlock_irq.
> because they are all called from a process context.
> 
> By applying this patch, we can avoid the problem above with 
> a following senario.
> 
>  - CPUA holds an efi_var->lock with interrupt disabled.
>  - CPUB panics and sends IPI to CPUA in smp_send_stop().
>  - CPUA receives the IPI after releasing the lock because it is
>    disabling interrupt while holding the lock.
>  - CPUB waits for one sec until CPUA releases the lock.
>  - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
>    And it can hold the lock successfully.
> 
> Signed-off-by: Seiji Aguchi <seiji.aguchi@....com>
> Acked-by: Mike Waychison <mikew@...gle.com>
> ---
>  drivers/firmware/efivars.c |   86 ++++++++++++++++++++++---------------------
>  1 files changed, 44 insertions(+), 42 deletions(-)

Acked-by: Matt Fleming <matt.fleming@...el.com>

Tony, are you picking this up?

-- 
Matt Fleming, Intel Open Source Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists