From: Ingo Molnar <mingo@kernel.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org
Subject: Re: [PATCH v2] x86: test that userspace stack is in fact NX
Date: Tue, 3 Oct 2023 21:01:20 +0200 [thread overview]
Message-ID: <ZRxlAC0oPlThUgaA@gmail.com> (raw)
In-Reply-To: <4cef8266-ad6d-48af-a5f1-fc2b6a8eb422@p183>
* Alexey Dobriyan <adobriyan@gmail.com> wrote:
> Here is how it works:
>
> * fault and fill the stack from rsp with int3 down until rlimit allows,
> * fill upwards with int3 too, overwrite libc stuff, argv, envp,
> * try to exec int3 on each page and catch it in either SIGSEGV or
> SIGTRAP handler.
>
> Note: trying to execute _every_ int3 on a 8 MiB stack takes 30-40 seconds
> even on fast machine which is too much for kernel selftesting
> (not for LTP!) so only 1 int3 per page is tried.
>
> Tested on F37 kernel and on a custom kernel which does
>
> vm_flags |= VM_EXEC;
>
> to stack VMA.
>
> Report from the buggy kernel:
>
> $ ./nx_stack_32
> stack min ff007000
> stack max ff807000
> FAIL executable page on the stack: eip ff806001
>
> $ ./nx_stack_64
> stack min 7ffe65bb0000
> stack max 7ffe663b0000
> FAIL executable page on the stack: rip 7ffe663af001
Nice, thanks!
Ingo
next prev parent reply other threads:[~2023-10-03 19:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-01 16:31 [PATCH] x86_64: test that userspace stack is in fact NX Alexey Dobriyan
2023-10-02 13:12 ` Ingo Molnar
2023-10-03 13:03 ` Alexey Dobriyan
2023-10-02 14:23 ` Dave Hansen
2023-10-03 13:00 ` Alexey Dobriyan
2023-10-03 14:23 ` Dave Hansen
2023-10-03 19:06 ` Ingo Molnar
2023-10-03 19:30 ` Ingo Molnar
2023-10-03 20:46 ` Dave Hansen
2023-10-03 21:53 ` H. Peter Anvin
2023-10-03 16:18 ` [PATCH v2] x86: " Alexey Dobriyan
2023-10-03 19:01 ` Ingo Molnar [this message]
2023-10-03 19:12 ` [tip: x86/mm] selftests/x86/mm: Add new " tip-bot2 for Alexey Dobriyan
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=ZRxlAC0oPlThUgaA@gmail.com \
--to=mingo@kernel.org \
--cc=adobriyan@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox