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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 6 May 2020 10:37:56 -0700
From:   Doug Anderson <dianders@...omium.org>
To:     Daniel Thompson <daniel.thompson@...aro.org>
Cc:     Jason Wessel <jason.wessel@...driver.com>,
        kgdb-bugreport@...ts.sourceforge.net,
        LKML <linux-kernel@...r.kernel.org>,
        Patch Tracking <patches@...aro.org>,
        Will Deacon <will@...nel.org>
Subject: Re: [PATCH] kgdb: Fix spurious true from in_dbg_master()

Hi,

On Wed, May 6, 2020 at 9:42 AM Daniel Thompson
<daniel.thompson@...aro.org> wrote:
>
> Currently there is a small window where a badly timed migration could
> cause in_dbg_master() to spuriously return true. Specifically if we
> migrate to a new core after reading the processor id and the previous
> core takes a breakpoint then we will evaluate true if we read
> kgdb_active before we get the IPI to bring us to halt.
>
> Fix this by checking irqs_disabled() first. Interrupts are always
> disabled when we are executing the kgdb trap so this is an acceptable
> prerequisite. This also allows us to replace raw_smp_processor_id()
> with smp_processor_id() since the short circuit logic will prevent
> warnings from PREEMPT_DEBUG.
>
> Fixes: dcc7871128e9 ("kgdb: core changes to support kdb")
> Suggested-by: Will Deacon <will@...nel.org>
> Signed-off-by: Daniel Thompson <daniel.thompson@...aro.org>
> ---
>  include/linux/kgdb.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
> index b072aeb1fd78..4d6fe87fd38f 100644
> --- a/include/linux/kgdb.h
> +++ b/include/linux/kgdb.h
> @@ -323,7 +323,7 @@ extern void gdbstub_exit(int status);
>  extern int                     kgdb_single_step;
>  extern atomic_t                        kgdb_active;
>  #define in_dbg_master() \
> -       (raw_smp_processor_id() == atomic_read(&kgdb_active))
> +       (irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active)))
>  extern bool dbg_is_early;
>  extern void __init dbg_late_init(void);
>  extern void kgdb_panic(const char *msg);

Reviewed-by: Douglas Anderson <dianders@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ