From: Will Deacon <will.deacon@arm.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: rostedt@goodmis.org, mingo@redhat.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, ryabinin.a.a@gmail.com,
surovegin@google.com, Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Alexander Potapenko <glider@google.com>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Masami Hiramatsu <mhiramat@kernel.org>,
x86@kernel.org, kasan-dev@googlegroups.com
Subject: Re: [PATCH v3] kprobes: unpoison stack in jprobe_return() for KASAN
Date: Fri, 14 Oct 2016 12:25:57 +0100 [thread overview]
Message-ID: <20161014112557.GE8197@arm.com> (raw)
In-Reply-To: <1476442436-97553-1-git-send-email-dvyukov@google.com>
On Fri, Oct 14, 2016 at 12:53:56PM +0200, Dmitry Vyukov wrote:
> KASAN stack instrumentation poisons stack redzones on function entry
> and unpoisons them on function exit. If a function exits abnormally
> (e.g. with a longjmp like jprobe_return()), stack redzones are left
> poisoned. Later this leads to random KASAN false reports.
>
> Unpoison stack redzones in the frames we are going to jump over
> before doing actual longjmp in jprobe_return().
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: x86@kernel.org
> Cc: kasan-dev@googlegroups.com
>
> --
>
> Changes since v1:
> - leave kasan_unpoison_remaining_stack() intact
> - instead add kasan_unpoison_stack_above_sp_to()
> - rename kasan_unpoison_remaining_stack() to kasan_unpoison_task_stack_below()
>
> Changes since v2:
> - fix build by adding return type to kasan_unpoison_stack_above_sp_to
> (tested v2 with it, but forgot to git add)
I get build warnings with this patch applied and KASAN enabled:
mm/kasan/kasan.c: In function ‘kasan_unpoison_task_stack_below’:
mm/kasan/kasan.c:82:34: warning: passing argument 2 of ‘__kasan_unpoison_stack’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
__kasan_unpoison_stack(current, watermark);
^~~~~~~~~
mm/kasan/kasan.c:65:13: note: expected ‘void *’ but argument is of type ‘const void *’
static void __kasan_unpoison_stack(struct task_struct *task, void *sp)
^~~~~~~~~~~~~~~~~~~~~~
mm/kasan/kasan.c: In function ‘kasan_unpoison_stack_above_sp_to’:
mm/kasan/kasan.c:92:27: error: called object ‘current_stack_pointer’ is not a function or function pointer
const void *sp = (void *)current_stack_pointer();
^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/thread_info.h:54:0,
from ./include/asm-generic/preempt.h:4,
from ./arch/arm64/include/generated/asm/preempt.h:1,
from ./include/linux/preempt.h:59,
from ./include/linux/interrupt.h:8,
from mm/kasan/kasan.c:20:
./arch/arm64/include/asm/thread_info.h:69:24: note: declared here
register unsigned long current_stack_pointer asm ("sp");
Will
next prev parent reply other threads:[~2016-10-14 11:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 10:53 [PATCH v3] kprobes: unpoison stack in jprobe_return() for KASAN Dmitry Vyukov
2016-10-14 11:15 ` Mark Rutland
2016-10-14 11:25 ` Will Deacon [this message]
2016-10-14 11:55 ` Dmitry Vyukov
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=20161014112557.GE8197@arm.com \
--to=will.deacon@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=ryabinin.a.a@gmail.com \
--cc=surovegin@google.com \
--cc=tglx@linutronix.de \
--cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.