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

Commit b11b5334 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Martin Schwidefsky
Browse files

[S390] Improve address space mode selection.



Introduce user_mode to replace the two variables switch_amode and
s390_noexec. There are three valid combinations of the old values:
  1) switch_amode == 0 && s390_noexec == 0
  2) switch_amode == 1 && s390_noexec == 0
  3) switch_amode == 1 && s390_noexec == 1
They get replaced by
  1) user_mode == HOME_SPACE_MODE
  2) user_mode == PRIMARY_SPACE_MODE
  3) user_mode == SECONDARY_SPACE_MODE
The new kernel parameter user_mode=[primary,secondary,home] lets
you choose the address space mode the user space processes should
use. In addition the CONFIG_S390_SWITCH_AMODE config option
is removed.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 61365e13
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -220,23 +220,8 @@ config AUDIT_ARCH
	bool
	default y

config S390_SWITCH_AMODE
	bool "Switch kernel/user addressing modes"
	help
	  This option allows to switch the addressing modes of kernel and user
	  space. The kernel parameter switch_amode=on will enable this feature,
	  default is disabled. Enabling this (via kernel parameter) on machines
	  earlier than IBM System z9-109 EC/BC will reduce system performance.

	  Note that this option will also be selected by selecting the execute
	  protection option below. Enabling the execute protection via the
	  noexec kernel parameter will also switch the addressing modes,
	  independent of the switch_amode kernel parameter.


config S390_EXEC_PROTECT
	bool "Data execute protection"
	select S390_SWITCH_AMODE
	help
	  This option allows to enable a buffer overflow protection for user
	  space programs and it also selects the addressing mode option above.
+0 −1
Original line number Diff line number Diff line
@@ -185,7 +185,6 @@ CONFIG_HOTPLUG_CPU=y
CONFIG_COMPAT=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_AUDIT_ARCH=y
CONFIG_S390_SWITCH_AMODE=y
CONFIG_S390_EXEC_PROTECT=y

#
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static inline int init_new_context(struct task_struct *tsk,
		mm->context.has_pgste = 1;
		mm->context.alloc_pgste = 1;
	} else {
		mm->context.noexec = s390_noexec;
		mm->context.noexec = (user_mode == SECONDARY_SPACE_MODE);
		mm->context.has_pgste = 0;
		mm->context.alloc_pgste = 0;
	}
@@ -58,7 +58,7 @@ static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
	pgd_t *pgd = mm->pgd;

	S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd);
	if (switch_amode) {
	if (user_mode != HOME_SPACE_MODE) {
		/* Load primary space page table origin. */
		pgd = mm->context.noexec ? get_shadow_table(pgd) : pgd;
		S390_lowcore.user_exec_asce = mm->context.asce_bits | __pa(pgd);
+2 −1
Original line number Diff line number Diff line
@@ -143,7 +143,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
	spin_lock_init(&mm->context.list_lock);
	INIT_LIST_HEAD(&mm->context.crst_list);
	INIT_LIST_HEAD(&mm->context.pgtable_list);
	return (pgd_t *) crst_table_alloc(mm, s390_noexec);
	return (pgd_t *)
		crst_table_alloc(mm, user_mode == SECONDARY_SPACE_MODE);
}
#define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd)

+6 −11
Original line number Diff line number Diff line
@@ -49,17 +49,12 @@ extern unsigned long memory_end;

void detect_memory_layout(struct mem_chunk chunk[]);

#ifdef CONFIG_S390_SWITCH_AMODE
extern unsigned int switch_amode;
#else
#define switch_amode	(0)
#endif

#ifdef CONFIG_S390_EXEC_PROTECT
extern unsigned int s390_noexec;
#else
#define s390_noexec	(0)
#endif
#define PRIMARY_SPACE_MODE	0
#define ACCESS_REGISTER_MODE	1
#define SECONDARY_SPACE_MODE	2
#define HOME_SPACE_MODE		3

extern unsigned int user_mode;

/*
 * Machine features detected in head.S
Loading