Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/vdso: Allow alternatives in vdso code

Implement the infrastructure required to allow alternatives in vdso code.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

authored by

Heiko Carstens and committed by
Jason A. Donenfeld
e10863ff a919390e

+23
+19
arch/s390/kernel/vdso.c
··· 12 12 #include <linux/errno.h> 13 13 #include <linux/init.h> 14 14 #include <linux/kernel.h> 15 + #include <linux/module.h> 15 16 #include <linux/mm.h> 16 17 #include <linux/slab.h> 17 18 #include <linux/smp.h> 18 19 #include <linux/time_namespace.h> 19 20 #include <linux/random.h> 20 21 #include <vdso/datapage.h> 22 + #include <asm/alternative.h> 21 23 #include <asm/vdso.h> 22 24 23 25 extern char vdso64_start[], vdso64_end[]; ··· 252 250 return pagelist; 253 251 } 254 252 253 + static void vdso_apply_alternatives(void) 254 + { 255 + const struct elf64_shdr *alt, *shdr; 256 + struct alt_instr *start, *end; 257 + const struct elf64_hdr *hdr; 258 + 259 + hdr = (struct elf64_hdr *)vdso64_start; 260 + shdr = (void *)hdr + hdr->e_shoff; 261 + alt = find_section(hdr, shdr, ".altinstructions"); 262 + if (!alt) 263 + return; 264 + start = (void *)hdr + alt->sh_offset; 265 + end = (void *)hdr + alt->sh_offset + alt->sh_size; 266 + apply_alternatives(start, end); 267 + } 268 + 255 269 static int __init vdso_init(void) 256 270 { 271 + vdso_apply_alternatives(); 257 272 vdso64_mapping.pages = vdso_setup_pages(vdso64_start, vdso64_end); 258 273 if (IS_ENABLED(CONFIG_COMPAT)) 259 274 vdso32_mapping.pages = vdso_setup_pages(vdso32_start, vdso32_end);
+4
arch/s390/kernel/vdso64/vdso64.lds.S
··· 42 42 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 43 43 .rodata1 : { *(.rodata1) } 44 44 45 + . = ALIGN(8); 46 + .altinstructions : { *(.altinstructions) } 47 + .altinstr_replacement : { *(.altinstr_replacement) } 48 + 45 49 .dynamic : { *(.dynamic) } :text :dynamic 46 50 47 51 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr