mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Merge tag 'execve-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull execve updates from Kees Cook: - Fix a few comments for correctness and typos (Baruch Siach) - Small simplifications for binfmt (Christophe JAILLET) - Set p_align to 4 for PT_NOTE in core dump (Fangrui Song) * tag 'execve-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: binfmt_elf: fix comment typo s/reset/regset/ elf: correct note name comment binfmt: Slightly simplify elf_fdpic_map_file() binfmt: Use struct_size() coredump, vmcore: Set p_align to 4 for PT_NOTE
This commit is contained in:
@@ -1517,7 +1517,7 @@ static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
|
|||||||
phdr->p_filesz = sz;
|
phdr->p_filesz = sz;
|
||||||
phdr->p_memsz = 0;
|
phdr->p_memsz = 0;
|
||||||
phdr->p_flags = 0;
|
phdr->p_flags = 0;
|
||||||
phdr->p_align = 0;
|
phdr->p_align = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_note(struct memelfnote *note, const char *name, int type,
|
static void fill_note(struct memelfnote *note, const char *name, int type,
|
||||||
@@ -1773,7 +1773,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
|
|||||||
/*
|
/*
|
||||||
* NT_PRSTATUS is the one special case, because the regset data
|
* NT_PRSTATUS is the one special case, because the regset data
|
||||||
* goes into the pr_reg field inside the note contents, rather
|
* goes into the pr_reg field inside the note contents, rather
|
||||||
* than being the whole note contents. We fill the reset in here.
|
* than being the whole note contents. We fill the regset in here.
|
||||||
* We assume that regset 0 is NT_PRSTATUS.
|
* We assume that regset 0 is NT_PRSTATUS.
|
||||||
*/
|
*/
|
||||||
fill_prstatus(&t->prstatus.common, t->task, signr);
|
fill_prstatus(&t->prstatus.common, t->task, signr);
|
||||||
|
@@ -743,12 +743,12 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
|
|||||||
struct elf32_fdpic_loadmap *loadmap;
|
struct elf32_fdpic_loadmap *loadmap;
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
struct elf32_fdpic_loadseg *mseg;
|
struct elf32_fdpic_loadseg *mseg;
|
||||||
|
unsigned long load_addr;
|
||||||
#endif
|
#endif
|
||||||
struct elf32_fdpic_loadseg *seg;
|
struct elf32_fdpic_loadseg *seg;
|
||||||
struct elf32_phdr *phdr;
|
struct elf32_phdr *phdr;
|
||||||
unsigned long load_addr, stop;
|
|
||||||
unsigned nloads, tmp;
|
unsigned nloads, tmp;
|
||||||
size_t size;
|
unsigned long stop;
|
||||||
int loop, ret;
|
int loop, ret;
|
||||||
|
|
||||||
/* allocate a load map table */
|
/* allocate a load map table */
|
||||||
@@ -760,8 +760,7 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
|
|||||||
if (nloads == 0)
|
if (nloads == 0)
|
||||||
return -ELIBBAD;
|
return -ELIBBAD;
|
||||||
|
|
||||||
size = sizeof(*loadmap) + nloads * sizeof(*seg);
|
loadmap = kzalloc(struct_size(loadmap, segs, nloads), GFP_KERNEL);
|
||||||
loadmap = kzalloc(size, GFP_KERNEL);
|
|
||||||
if (!loadmap)
|
if (!loadmap)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@@ -770,9 +769,6 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
|
|||||||
loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
|
loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
|
||||||
loadmap->nsegs = nloads;
|
loadmap->nsegs = nloads;
|
||||||
|
|
||||||
load_addr = params->load_addr;
|
|
||||||
seg = loadmap->segs;
|
|
||||||
|
|
||||||
/* map the requested LOADs into the memory space */
|
/* map the requested LOADs into the memory space */
|
||||||
switch (params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) {
|
switch (params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) {
|
||||||
case ELF_FDPIC_FLAG_CONSTDISP:
|
case ELF_FDPIC_FLAG_CONSTDISP:
|
||||||
@@ -1269,7 +1265,7 @@ static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offs
|
|||||||
phdr->p_filesz = sz;
|
phdr->p_filesz = sz;
|
||||||
phdr->p_memsz = 0;
|
phdr->p_memsz = 0;
|
||||||
phdr->p_flags = 0;
|
phdr->p_flags = 0;
|
||||||
phdr->p_align = 0;
|
phdr->p_align = 4;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -877,7 +877,7 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz,
|
|||||||
phdr.p_offset = roundup(note_off, PAGE_SIZE);
|
phdr.p_offset = roundup(note_off, PAGE_SIZE);
|
||||||
phdr.p_vaddr = phdr.p_paddr = 0;
|
phdr.p_vaddr = phdr.p_paddr = 0;
|
||||||
phdr.p_filesz = phdr.p_memsz = phdr_sz;
|
phdr.p_filesz = phdr.p_memsz = phdr_sz;
|
||||||
phdr.p_align = 0;
|
phdr.p_align = 4;
|
||||||
|
|
||||||
/* Add merged PT_NOTE program header*/
|
/* Add merged PT_NOTE program header*/
|
||||||
tmp = elfptr + sizeof(Elf64_Ehdr);
|
tmp = elfptr + sizeof(Elf64_Ehdr);
|
||||||
@@ -1068,7 +1068,7 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz,
|
|||||||
phdr.p_offset = roundup(note_off, PAGE_SIZE);
|
phdr.p_offset = roundup(note_off, PAGE_SIZE);
|
||||||
phdr.p_vaddr = phdr.p_paddr = 0;
|
phdr.p_vaddr = phdr.p_paddr = 0;
|
||||||
phdr.p_filesz = phdr.p_memsz = phdr_sz;
|
phdr.p_filesz = phdr.p_memsz = phdr_sz;
|
||||||
phdr.p_align = 0;
|
phdr.p_align = 4;
|
||||||
|
|
||||||
/* Add merged PT_NOTE program header*/
|
/* Add merged PT_NOTE program header*/
|
||||||
tmp = elfptr + sizeof(Elf32_Ehdr);
|
tmp = elfptr + sizeof(Elf32_Ehdr);
|
||||||
|
@@ -372,7 +372,8 @@ typedef struct elf64_shdr {
|
|||||||
* Notes used in ET_CORE. Architectures export some of the arch register sets
|
* Notes used in ET_CORE. Architectures export some of the arch register sets
|
||||||
* using the corresponding note types via the PTRACE_GETREGSET and
|
* using the corresponding note types via the PTRACE_GETREGSET and
|
||||||
* PTRACE_SETREGSET requests.
|
* PTRACE_SETREGSET requests.
|
||||||
* The note name for all these is "LINUX".
|
* The note name for these types is "LINUX", except NT_PRFPREG that is named
|
||||||
|
* "CORE".
|
||||||
*/
|
*/
|
||||||
#define NT_PRSTATUS 1
|
#define NT_PRSTATUS 1
|
||||||
#define NT_PRFPREG 2
|
#define NT_PRFPREG 2
|
||||||
|
Reference in New Issue
Block a user