From: David Laight <David.Laight@ACULAB.COM>
To: "'Johannes Berg'" <johannes@sipsolutions.net>,
Arnd Bergmann <arnd@arndb.de>, David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Andrey Ryabinin" <a.ryabinin@samsung.com>,
"nikolay@cumulusnetworks.com" <nikolay@cumulusnetworks.com>,
"nicolas.dichtel@6wind.com" <nicolas.dichtel@6wind.com>,
"adobriyan@gmail.com" <adobriyan@gmail.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: RE: KASAN+netlink, was: [PATCH] [net-next?] hns: avoid stack overflow with CONFIG_KASAN
Date: Wed, 8 Feb 2017 16:00:24 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB027F2B4@AcuExch.aculab.com> (raw)
In-Reply-To: <1486556665.24745.6.camel@sipsolutions.net>
> From: Johannes Berg
> Sent: 08 February 2017 12:24
...
> Btw, what's causing this to start with? Can't the compiler reuse the
> stack places?
Only if it realises they've gone out of scope - which probably
doesn't happen when the functions are inlined.
The address of the parameter can be saved by the calling function
and used in a later call.
Something like this is valid:
int foo(int *p, int v)
{
static int *sv;
int old = -1;
if (sv) {old = *sv; *sv = v;}
sv = v;
return old;
}
void bar(...) {
int a, b;
...
foo(&a, 0);
...
foo(&b, 1);
...
foo(NULL, 2);
...
If the compiler starts sharing stack it all goes wrong.
David
next prev parent reply other threads:[~2017-02-08 16:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 16:35 Arnd Bergmann
2017-02-06 17:03 ` David Miller
2017-02-08 12:03 ` KASAN+netlink, was: " Arnd Bergmann
2017-02-08 12:24 ` Johannes Berg
2017-02-08 13:10 ` Arnd Bergmann
2017-02-08 14:58 ` Andrey Ryabinin
2017-02-08 16:00 ` David Laight [this message]
2017-02-08 16:27 ` David Miller
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=063D6719AE5E284EB5DD2968C1650D6DB027F2B4@AcuExch.aculab.com \
--to=david.laight@aculab.com \
--cc=a.ryabinin@samsung.com \
--cc=adobriyan@gmail.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=nikolay@cumulusnetworks.com \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®