linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "# 3.4.x" <stable@vger.kernel.org>,
	Sergey Kozlov <serjk@netup.ru>, Abylay Ospan <aospan@netup.ru>,
	Daniel Scheller <d.scheller@gmx.net>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Masanari Iida <standby24x7@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Randy Dunlap <rdunlap@infradead.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH, RESEND 1/2] dvb-frontends: fix i2c access helpers for KASAN
Date: Thu, 30 Nov 2017 15:06:15 +0100	[thread overview]
Message-ID: <CAK8P3a0dp0S8h0pV+1mexD=-LdRRW8D55tLmx5x9usCQkzNTqw@mail.gmail.com> (raw)
In-Reply-To: <20171130104934.30dcfdf6@vento.lan>

On Thu, Nov 30, 2017 at 1:49 PM, Mauro Carvalho Chehab
<mchehab@kernel.org> wrote:
>> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> I'm undecided here whether there should be a comment pointing
>> to PR81715 for each file that the bogus local variable workaround
>> to prevent it from being cleaned up again. It's probably not
>> necessary since anything that causes actual problems would also
>> trigger a build warning.

>
> This kind of sucks, and it is completely unexpected... why val is
> so special that it would require this kind of hack?

It's explained in the gcc bug report: basically gcc always skipped
one optimization on inline function arguments that it does on
normal variables. Without KASAN and asan-stack, we didn't
notice because the impact was fairly small, but I ended up finally
getting to the bottom of it in September, and it finally got fixed.

I had an older version of the patch that was much more invasive
before we understood what exactly is happening, see
https://lkml.org/lkml/2017/3/2/484

> Also, there's always a risk of someone see it and decide to
> simplify the code, returning it to the previous state.
>
> So, if we're willing to do something like that, IMHO, we should have
> some macro that would document it, and fall back to the direct
> code if the compiler is not gcc 5, 6 or 7.

Older compilers are also affected and will produce better code
with my change, the difference is just smaller without asan-stack
(added ion gcc-5) is disabled, since that increases the stack
space used by each variable to (IIRC) 32 bytes.

The fixed gcc-8 produces identical code with and without my
change.

I don't think that a macro would help here at all, but if you
prefer, I could add a link to that gcc bug in each function that
has the problem.

         Arnd

  reply	other threads:[~2017-11-30 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 11:08 [PATCH, RESEND 1/2] dvb-frontends: fix i2c access helpers for KASAN Arnd Bergmann
2017-11-30 11:08 ` [PATCH, RESEND 2/2] r820t: fix r820t_write_reg " Arnd Bergmann
2017-11-30 12:49 ` [PATCH, RESEND 1/2] dvb-frontends: fix i2c access helpers " Mauro Carvalho Chehab
2017-11-30 14:06   ` Arnd Bergmann [this message]
2017-11-30 14:53     ` Mauro Carvalho Chehab

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='CAK8P3a0dp0S8h0pV+1mexD=-LdRRW8D55tLmx5x9usCQkzNTqw@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=adobriyan@gmail.com \
    --cc=aospan@netup.ru \
    --cc=d.scheller@gmx.net \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=serjk@netup.ru \
    --cc=stable@vger.kernel.org \
    --cc=standby24x7@gmail.com \
    /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).