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

Commit 043d0708 authored by Martin Schwidefsky's avatar Martin Schwidefsky
Browse files

[S390] Remove data execution protection



The noexec support on s390 does not rely on a bit in the page table
entry but utilizes the secondary space mode to distinguish between
memory accesses for instructions vs. data. The noexec code relies
on the assumption that the cpu will always use the secondary space
page table for data accesses while it is running in the secondary
space mode. Up to the z9-109 class machines this has been the case.
Unfortunately this is not true anymore with z10 and later machines.
The load-relative-long instructions lrl, lgrl and lgfrl access the
memory operand using the same addressing-space mode that has been
used to fetch the instruction.
This breaks the noexec mode for all user space binaries compiled
with march=z10 or later. The only option is to remove the current
noexec support.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 9bf05098
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -230,17 +230,6 @@ config SYSVIPC_COMPAT
config AUDIT_ARCH
	def_bool y

config S390_EXEC_PROTECT
	def_bool y
	prompt "Data execute protection"
	help
	  This option allows to enable a buffer overflow protection for user
	  space programs and it also selects the addressing mode option above.
	  The kernel parameter noexec=on will enable this feature and also
	  switch the addressing modes, default is disabled. Enabling this (via
	  kernel parameter) on machines earlier than IBM System z9 this will
	  reduce system performance.

comment "Code generation options"

choice
+0 −12
Original line number Diff line number Diff line
@@ -196,18 +196,6 @@ do { \
} while (0)
#endif /* __s390x__ */

/*
 * An executable for which elf_read_implies_exec() returns TRUE will
 * have the READ_IMPLIES_EXEC personality flag set automatically.
 */
#define elf_read_implies_exec(ex, executable_stack)	\
({							\
	if (current->mm->context.noexec &&		\
	    executable_stack != EXSTACK_DISABLE_X)	\
		disable_noexec(current->mm, current);	\
	current->mm->context.noexec == 0;		\
})

#define STACK_RND_MASK	0x7ffUL

#define ARCH_DLINFO							    \
+3 −14
Original line number Diff line number Diff line
@@ -111,21 +111,10 @@ static inline void huge_ptep_invalidate(struct mm_struct *mm,
{
	pmd_t *pmdp = (pmd_t *) ptep;

	if (!MACHINE_HAS_IDTE) {
		__pmd_csp(pmdp);
		if (mm->context.noexec) {
			pmdp = get_shadow_table(pmdp);
			__pmd_csp(pmdp);
		}
		return;
	}

	__pmd_idte(address, pmdp);
	if (mm->context.noexec) {
		pmdp = get_shadow_table(pmdp);
	if (MACHINE_HAS_IDTE)
		__pmd_idte(address, pmdp);
	}
	return;
	else
		__pmd_csp(pmdp);
}

#define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
+2 −2
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ struct _lowcore {
	/* Address space pointer. */
	__u32	kernel_asce;			/* 0x02ac */
	__u32	user_asce;			/* 0x02b0 */
	__u32	user_exec_asce;			/* 0x02b4 */
	__u8	pad_0x02b4[0x02b8-0x02b4];	/* 0x02b4 */

	/* SMP info area */
	__u32	cpu_nr;				/* 0x02b8 */
@@ -255,7 +255,7 @@ struct _lowcore {
	/* Address space pointer. */
	__u64	kernel_asce;			/* 0x0310 */
	__u64	user_asce;			/* 0x0318 */
	__u64	user_exec_asce;			/* 0x0320 */
	__u8	pad_0x0320[0x0328-0x0320];	/* 0x0320 */

	/* SMP info area */
	__u32	cpu_nr;				/* 0x0328 */
+0 −3
Original line number Diff line number Diff line
@@ -5,19 +5,16 @@ typedef struct {
	atomic_t attach_count;
	unsigned int flush_mm;
	spinlock_t list_lock;
	struct list_head crst_list;
	struct list_head pgtable_list;
	unsigned long asce_bits;
	unsigned long asce_limit;
	unsigned long vdso_base;
	int noexec;
	int has_pgste;	 /* The mmu context has extended page tables */
	int alloc_pgste; /* cloned contexts will have extended page tables */
} mm_context_t;

#define INIT_MM_CONTEXT(name)						      \
	.context.list_lock    = __SPIN_LOCK_UNLOCKED(name.context.list_lock), \
	.context.crst_list    = LIST_HEAD_INIT(name.context.crst_list),	      \
	.context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list),

#endif
Loading