Re: [PATCH][RESEND] PIE randomization
From: Jiri Kosina
Date: Mon Jul 09 2007 - 07:37:33 EST
On Sat, 7 Jul 2007, Jakub Jelinek wrote:
> I believe BAD_ADDR macro was changes from ((unsigned long)(x) >=
> TASK_SIZE) (which is the right test for invalid user addresses, stronger
> check than >= PAGE_MASK) to >= PAGE_MASK only because of the one check
> of the return value of load_elf_interp.
Yes, this is correct.
> All other uses of BAD_ADDR macro are either on userland addresses (what
> do_mmap, elf_map, do_brk etc. return; where TASK_SIZE or more is
> certainly wrong)
True. But these functions are supposed to perform all the necessary checks
and return ERR_PTR if anything fails, so everything is fine and nothing
gets broken.
> or in one case still on unbiased ELF p_vaddr: if (BAD_ADDR(k) ||
> elf_ppnt->p_filesz > elf_ppnt->p_memsz || in load_elf_binary (where >=
> TASK_SIZE check is ok too).
> So perhaps doing this instead of changing BAD_ADDR to IS_ERR_VAL
> might be better:
> Signed-off-by: Jakub Jelinek <jakub@xxxxxxxxxx>
[ ... ]
> - if (!BAD_ADDR(elf_entry)) {
> + if (!IS_ERR((void *)elf_entry)) {
I agree that this is better solution. Andrew, this Jakub's patch should
replace the pie-randomization-fix-bad_addr-macro.patch if possible. You
can add
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
if that makes any difference.
Thanks,
--
Jiri Kosina
SUSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/