Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e06fdaf4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull structure randomization updates from Kees Cook:
 "Now that IPC and other changes have landed, enable manual markings for
  randstruct plugin, including the task_struct.

  This is the rest of what was staged in -next for the gcc-plugins, and
  comes in three patches, largest first:

   - mark "easy" structs with __randomize_layout

   - mark task_struct with an optional anonymous struct to isolate the
     __randomize_layout section

   - mark structs to opt _out_ of automated marking (which will come
     later)

  And, FWIW, this continues to pass allmodconfig (normal and patched to
  enable gcc-plugins) builds of x86_64, i386, arm64, arm, powerpc, and
  s390 for me"

* tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  randstruct: opt-out externally exposed function pointer structs
  task_struct: Allow randomized layout
  randstruct: Mark various structs for randomization
parents a90c6ac2 8acdf505
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -84,7 +84,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 {
@@ -92,12 +92,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 */
@@ -176,7 +176,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 {
	/*
@@ -199,7 +199,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);
@@ -305,7 +305,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
@@ -322,7 +322,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
@@ -334,7 +334,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;
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ struct cpuinfo_x86 {
	/* Index into per_cpu list: */
	u16			cpu_index;
	u32			microcode;
};
} __randomize_layout;

struct cpuid_regs {
	u32 eax, ebx, ecx, edx;
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ struct mnt_namespace {
	u64 event;
	unsigned int		mounts; /* # of mounts in the namespace */
	unsigned int		pending_mounts;
};
} __randomize_layout;

struct mnt_pcp {
	int mnt_count;
@@ -69,7 +69,7 @@ struct mount {
	struct hlist_head mnt_pins;
	struct fs_pin mnt_umount;
	struct dentry *mnt_ex_mountpoint;
};
} __randomize_layout;

#define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */

+1 −1
Original line number Diff line number Diff line
@@ -524,7 +524,7 @@ struct nameidata {
	struct inode	*link_inode;
	unsigned	root_seq;
	int		dfd;
};
} __randomize_layout;

static void set_nameidata(struct nameidata *p, int dfd, struct filename *name)
{
Loading