Skip to content

Commit

Permalink
x86, UML: fix integer overflow in ELF_ET_DYN_BASE
Browse files Browse the repository at this point in the history
Almost all arches define ELF_ET_DYN_BASE as 2/3 of TASK_SIZE.
Though it seems that some architectures do this in a wrong way.
The problem is that 2*TASK_SIZE may overflow 32-bits so
the real ELF_ET_DYN_BASE becomes wrong.
Fix this overflow by dividing TASK_SIZE prior to multiplying:
	(TASK_SIZE / 3 * 2)

Signed-off-by: Andrey Ryabinin <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
aryabinin authored and richardweinberger committed Apr 13, 2015
1 parent 0c9bd63 commit fc9bea0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/um/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);

#define ELF_EXEC_PAGESIZE 4096

#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)

extern long elf_aux_hwcap;
#define ELF_HWCAP (elf_aux_hwcap)
Expand Down

0 comments on commit fc9bea0

Please sign in to comment.