diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 04c4aa7a1df2c59716abaa12aefdf29fd7d4630c..1651afc8656a97a29236ac40bf72c968aa9ebf63 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1034,6 +1034,11 @@ static int load_elf_binary(struct linux_binprm *bprm) unsigned long total_size = 0; unsigned long alignment; + if (elf_ppnt->p_type == PT_OHOS_RANDOMDATA) { + get_random_bytes((void *)(elf_ppnt->p_vaddr + load_bias), (int)elf_ppnt->p_memsz); + continue; + } + if (elf_ppnt->p_type != PT_LOAD) continue; diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 30f68b42eeb53f58b7140b519f07bc623cf43ba4..2f06a1195fee0064a5786aee8089f5dc060a6e63 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -38,6 +38,8 @@ typedef __s64 Elf64_Sxword; #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_PROPERTY 0x6474e553 +#define PT_OHOS_RANDOMDATA 0x6788fc60 /* ohos-specific segment */ + #define PT_GNU_STACK (PT_LOOS + 0x474e551) /*