linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Matthias Kaehlcke' <mka@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Evan Green <evgreen@chromium.org>,
	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>,
	Douglas Anderson <dianders@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Manoj Gupta <manojgupta@chromium.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: RE: [PATCH] tty/sysrq: Make local variable 'killer' in sysrq_handle_crash() global
Date: Tue, 18 Sep 2018 11:46:30 +0000	[thread overview]
Message-ID: <0d8470c7fdbe4429af82b830d39215f3@AcuMS.aculab.com> (raw)
In-Reply-To: <20180917213304.44476-1-mka@chromium.org>

From: Matthias Kaehlcke
> Sent: 17 September 2018 22:33
> 
> sysrq_handle_crash() dereferences a NULL pointer on purpose to force
> an exception, the local variable 'killer' is assigned to NULL and
> dereferenced later. Clang detects the NULL pointer dereference at compile
> time and emits a BRK instruction (on arm64) instead of the expected NULL
> pointer exception. Change 'killer' to a global variable (and rename it
> to 'sysrq_killer' to avoid possible clashes) to prevent Clang from
> detecting the condition. By default global variables are initialized
> with zero/NULL in C, therefore an explicit initialization is not needed.

You need an explicit initialiser in order to make it global data
rather than a common section.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


      parent reply	other threads:[~2018-09-18 11:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 21:33 [PATCH] tty/sysrq: Make local variable 'killer' in sysrq_handle_crash() global Matthias Kaehlcke
2018-09-18  6:09 ` Sai Prakash Ranjan
2018-09-18  6:11 ` Jiri Slaby
2018-09-18  6:58   ` Sai Prakash Ranjan
2018-09-18  7:20     ` Greg Kroah-Hartman
2018-09-18  9:05       ` Sai Prakash Ranjan
2018-09-18  9:17         ` Greg Kroah-Hartman
2018-09-18  9:53           ` Sai Prakash Ranjan
     [not found]           ` <32bf1760-4967-a37a-6a17-3f7d5f6e071e@suse.cz>
2018-09-18 17:32             ` Matthias Kaehlcke
2018-09-18 17:24   ` Matthias Kaehlcke
2018-09-18 11:46 ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d8470c7fdbe4429af82b830d39215f3@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manojgupta@chromium.org \
    --cc=mka@chromium.org \
    --cc=ndesaulniers@google.com \
    --cc=saiprakash.ranjan@codeaurora.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).