diff options
Diffstat (limited to 'arch/s390/kernel/module.c')
| -rw-r--r-- | arch/s390/kernel/module.c | 42 | 
1 files changed, 21 insertions, 21 deletions
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index b01ba460b7ca..b032e556eeb7 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c @@ -33,18 +33,19 @@  #define DEBUGP(fmt , ...)  #endif -#define PLT_ENTRY_SIZE 20 +#define PLT_ENTRY_SIZE 22  void *module_alloc(unsigned long size)  { +	gfp_t gfp_mask = GFP_KERNEL;  	void *p;  	if (PAGE_ALIGN(size) > MODULES_LEN)  		return NULL;  	p = __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR, MODULES_END, -				 GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, +				 gfp_mask, PAGE_KERNEL_EXEC, VM_DEFER_KMEMLEAK, NUMA_NO_NODE,  				 __builtin_return_address(0)); -	if (p && (kasan_module_alloc(p, size) < 0)) { +	if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) {  		vfree(p);  		return NULL;  	} @@ -340,27 +341,26 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,  	case R_390_PLTOFF32:	/* 32 bit offset from GOT to PLT. */  	case R_390_PLTOFF64:	/* 16 bit offset from GOT to PLT. */  		if (info->plt_initialized == 0) { -			unsigned int insn[5]; -			unsigned int *ip = me->core_layout.base + -					   me->arch.plt_offset + -					   info->plt_offset; - -			insn[0] = 0x0d10e310;	/* basr 1,0  */ -			insn[1] = 0x100a0004;	/* lg	1,10(1) */ +			unsigned char insn[PLT_ENTRY_SIZE]; +			char *plt_base; +			char *ip; + +			plt_base = me->core_layout.base + me->arch.plt_offset; +			ip = plt_base + info->plt_offset; +			*(int *)insn = 0x0d10e310;	/* basr 1,0  */ +			*(int *)&insn[4] = 0x100c0004;	/* lg	1,12(1) */  			if (IS_ENABLED(CONFIG_EXPOLINE) && !nospec_disable) { -				unsigned int *ij; -				ij = me->core_layout.base + -					me->arch.plt_offset + -					me->arch.plt_size - PLT_ENTRY_SIZE; -				insn[2] = 0xa7f40000 +	/* j __jump_r1 */ -					(unsigned int)(u16) -					(((unsigned long) ij - 8 - -					  (unsigned long) ip) / 2); +				char *jump_r1; + +				jump_r1 = plt_base + me->arch.plt_size - +					PLT_ENTRY_SIZE; +				/* brcl	0xf,__jump_r1 */ +				*(short *)&insn[8] = 0xc0f4; +				*(int *)&insn[10] = (jump_r1 - (ip + 8)) / 2;  			} else { -				insn[2] = 0x07f10000;	/* br %r1 */ +				*(int *)&insn[8] = 0x07f10000;	/* br %r1 */  			} -			insn[3] = (unsigned int) (val >> 32); -			insn[4] = (unsigned int) val; +			*(long *)&insn[14] = val;  			write(ip, insn, sizeof(insn));  			info->plt_initialized = 1;  |