linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: kernel-hardening@lists.openwall.com
Cc: Kees Cook <keescook@chromium.org>,
	Laura Abbott <labbott@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 10/20] randstruct: opt-out externally exposed function pointer structs
Date: Fri, 26 May 2017 13:17:14 -0700	[thread overview]
Message-ID: <1495829844-69341-11-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1495829844-69341-1-git-send-email-keescook@chromium.org>

Some function pointer structures are used externally to the kernel, like
the paravirt structures. These should never be randomized, so mark them as
such. This set was extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/arm/include/asm/cacheflush.h     |  2 +-
 arch/x86/include/asm/paravirt_types.h | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index d69bebf697e7..74504b154256 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -116,7 +116,7 @@ struct cpu_cache_fns {
 	void (*dma_unmap_area)(const void *, size_t, int);
 
 	void (*dma_flush_range)(const void *, const void *);
-};
+} __no_randomize_layout;
 
 /*
  * Select the calling method
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 7465d6fe336f..96c7e3cf43fa 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -83,7 +83,7 @@ struct pv_init_ops {
 	 */
 	unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
 			  unsigned long addr, unsigned len);
-};
+} __no_randomize_layout;
 
 
 struct pv_lazy_ops {
@@ -91,12 +91,12 @@ struct pv_lazy_ops {
 	void (*enter)(void);
 	void (*leave)(void);
 	void (*flush)(void);
-};
+} __no_randomize_layout;
 
 struct pv_time_ops {
 	unsigned long long (*sched_clock)(void);
 	unsigned long long (*steal_clock)(int cpu);
-};
+} __no_randomize_layout;
 
 struct pv_cpu_ops {
 	/* hooks for various privileged instructions */
@@ -175,7 +175,7 @@ struct pv_cpu_ops {
 
 	void (*start_context_switch)(struct task_struct *prev);
 	void (*end_context_switch)(struct task_struct *next);
-};
+} __no_randomize_layout;
 
 struct pv_irq_ops {
 	/*
@@ -198,7 +198,7 @@ struct pv_irq_ops {
 #ifdef CONFIG_X86_64
 	void (*adjust_exception_frame)(void);
 #endif
-};
+} __no_randomize_layout;
 
 struct pv_mmu_ops {
 	unsigned long (*read_cr2)(void);
@@ -306,7 +306,7 @@ struct pv_mmu_ops {
 	   an mfn.  We can tell which is which from the index. */
 	void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
 			   phys_addr_t phys, pgprot_t flags);
-};
+} __no_randomize_layout;
 
 struct arch_spinlock;
 #ifdef CONFIG_SMP
@@ -323,7 +323,7 @@ struct pv_lock_ops {
 	void (*kick)(int cpu);
 
 	struct paravirt_callee_save vcpu_is_preempted;
-};
+} __no_randomize_layout;
 
 /* This contains all the paravirt structures: we get a convenient
  * number for each function using the offset which we use to indicate
@@ -335,7 +335,7 @@ struct paravirt_patch_template {
 	struct pv_irq_ops pv_irq_ops;
 	struct pv_mmu_ops pv_mmu_ops;
 	struct pv_lock_ops pv_lock_ops;
-};
+} __no_randomize_layout;
 
 extern struct pv_info pv_info;
 extern struct pv_init_ops pv_init_ops;
-- 
2.7.4

  parent reply	other threads:[~2017-05-27  1:11 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 20:17 [PATCH v2 00/20] Introduce struct layout randomization plugin Kees Cook
2017-05-26 20:17 ` [PATCH v2 01/20] NFS: Avoid cross-structure casting Kees Cook
2017-05-28  7:53   ` Christoph Hellwig
2017-05-28 16:55     ` Kees Cook
2017-05-26 20:17 ` [PATCH v2 02/20] gcc-plugins: Detail c-common.h location for GCC 4.6 Kees Cook
2017-05-26 20:17 ` [PATCH v2 03/20] compiler: Add __designated_init annotation Kees Cook
2017-05-26 20:17 ` [PATCH v2 04/20] gcc-plugins: Add the randstruct plugin Kees Cook
2017-06-29 22:08   ` Arnd Bergmann
2017-06-29 22:53     ` Kees Cook
2017-06-30  0:04       ` Kees Cook
2017-06-30  7:35       ` Arnd Bergmann
2017-06-30  7:55         ` Ard Biesheuvel
2017-06-30  8:27           ` Arnd Bergmann
2017-06-30 14:41             ` Kees Cook
2017-06-30 15:22               ` Arnd Bergmann
2017-05-26 20:17 ` [PATCH v2 05/20] randstruct: Whitelist struct security_hook_heads cast Kees Cook
2017-05-27  8:41   ` Christoph Hellwig
2017-05-27 20:09     ` Kees Cook
2017-05-27 22:04       ` Tetsuo Handa
2017-05-28  0:43         ` [kernel-hardening] " Kees Cook
2017-05-30 10:34       ` James Morris
2017-05-26 20:17 ` [PATCH v2 06/20] randstruct: Whitelist UNIXCB cast Kees Cook
2017-05-26 20:20   ` Kees Cook
2017-05-28  7:56   ` Christoph Hellwig
2017-05-26 20:17 ` [PATCH v2 07/20] randstruct: Whitelist big_key path struct overloading Kees Cook
2017-05-28  8:12   ` Christoph Hellwig
2017-05-28 16:59     ` Kees Cook
2017-06-19 19:24       ` Kees Cook
2017-09-07  7:20         ` Christoph Hellwig
2017-09-07 22:55           ` Kees Cook
2017-05-26 20:17 ` [PATCH v2 08/20] randstruct: Whitelist NIU struct page overloading Kees Cook
2017-05-28  8:15   ` Christoph Hellwig
2017-05-28 17:35     ` Kees Cook
2017-05-28 17:37     ` Kees Cook
2017-05-26 20:17 ` [PATCH v2 09/20] randstruct: Mark various structs for randomization Kees Cook
2017-05-26 20:17 ` Kees Cook [this message]
2017-05-26 20:17 ` [PATCH v2 11/20] randstruct: Disable randomization of ACPICA structs Kees Cook
2017-05-27  8:42   ` Christoph Hellwig
2017-05-27 20:03     ` Kees Cook
2017-05-28  4:55       ` Christoph Hellwig
2017-05-26 20:17 ` [PATCH v2 12/20] sgi-xp: Use designated initializers Kees Cook
2017-05-27  8:44   ` Christoph Hellwig
2017-05-26 20:17 ` [PATCH v2 13/20] drm/amdgpu: " Kees Cook
2017-05-26 20:17 ` [PATCH v2 14/20] drm/amd/powerplay: " Kees Cook
2017-05-27  8:47   ` Christoph Hellwig
2017-05-27 20:10     ` Kees Cook
2017-05-26 20:17 ` [PATCH v2 15/20] mtk-vcodec: " Kees Cook
2017-05-26 20:17 ` [PATCH v2 16/20] ntfs: Use ERR_CAST() to avoid cross-structure cast Kees Cook
2017-05-26 20:17 ` [PATCH v2 17/20] ocfs2: " Kees Cook
2017-05-26 20:17 ` [PATCH v2 18/20] randstruct: Enable function pointer struct detection Kees Cook
2017-05-26 20:17 ` [PATCH v2 19/20] [RFC] task_struct: Allow randomized layout Kees Cook
2017-05-26 20:23   ` Linus Torvalds
2017-05-26 20:32     ` Kees Cook
2017-05-26 20:17 ` [PATCH v2 20/20] ACPICA: Use designated initializers Kees Cook
2017-05-28  7:45   ` Christoph Hellwig

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=1495829844-69341-11-git-send-email-keescook@chromium.org \
    --to=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).