From: Peter Zijlstra <peterz@infradead.org>
To: Kees Cook <keescook@chromium.org>
Cc: kernel-hardening@lists.openwall.com,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 1/4] task_struct: Allow randomized layout
Date: Mon, 26 Mar 2018 14:03:21 +0200 [thread overview]
Message-ID: <20180326120321.GD4129@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180326115246.GA4147@hirez.programming.kicks-ass.net>
On Mon, Mar 26, 2018 at 01:52:46PM +0200, Peter Zijlstra wrote:
> That now looks like:
>
> struct task_struct {
> struct thread_info thread_info; /* 0 16 */
> volatile long int state; /* 16 8 */
>
> /* XXX 40 bytes hole, try to pack */
>
> /* --- cacheline 1 boundary (64 bytes) --- */
> struct {
> void * stack; /* 64 8 */
> atomic_t usage; /* 72 4 */
> unsigned int flags; /* 76 4 */
> unsigned int ptrace; /* 80 4 */
> struct llist_node wake_entry; /* 88 8 */
>
>
> Can we please undo this crap?
The below gets rid of that nonsense.
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index e2c7f4369eff..767cf74d61f7 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -242,6 +242,15 @@
#if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
#define __randomize_layout __attribute__((randomize_layout))
#define __no_randomize_layout __attribute__((no_randomize_layout))
+/*
+ * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only
+ * possible since GCC 4.6. To provide as much build testing coverage
+ * as possible, this is used for all GCC 4.6+ builds, and not just on
+ * RANDSTRUCT_PLUGIN builds.
+ */
+#define randomized_struct_fields_start struct {
+#define randomized_struct_fields_end } __randomize_layout;
+
#endif
#endif /* GCC_VERSION >= 40500 */
@@ -256,15 +265,6 @@
*/
#define __visible __attribute__((externally_visible))
-/*
- * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only
- * possible since GCC 4.6. To provide as much build testing coverage
- * as possible, this is used for all GCC 4.6+ builds, and not just on
- * RANDSTRUCT_PLUGIN builds.
- */
-#define randomized_struct_fields_start struct {
-#define randomized_struct_fields_end } __randomize_layout;
-
#endif /* GCC_VERSION >= 40600 */
next prev parent reply other threads:[~2018-03-26 12:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 20:56 [PATCH v3 0/4] randstruct: Enable function pointer struct detection Kees Cook
2017-06-19 20:56 ` [PATCH 1/4] task_struct: Allow randomized layout Kees Cook
2018-03-26 11:52 ` Peter Zijlstra
2018-03-26 12:03 ` Peter Zijlstra [this message]
2018-03-26 17:43 ` Kees Cook
2017-06-19 20:56 ` [PATCH 2/4] randstruct: opt-out externally exposed function pointer structs Kees Cook
2017-06-19 20:56 ` [PATCH 3/4] randstruct: Disable randomization of ACPICA structs Kees Cook
2017-06-20 6:56 ` Christoph Hellwig
2017-06-20 19:25 ` Kees Cook
2017-06-20 20:35 ` Christoph Hellwig
2017-06-20 20:52 ` Rafael J. Wysocki
2017-06-20 21:34 ` Rafael J. Wysocki
2017-06-22 23:57 ` Kees Cook
2017-06-22 23:59 ` Rafael J. Wysocki
2017-06-23 0:20 ` Kees Cook
2017-06-19 20:56 ` [PATCH 4/4] randstruct: Enable function pointer struct detection Kees Cook
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=20180326120321.GD4129@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.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