Re: [PATCH] i386 and x86_64: randomize brk()

From: Franck Bui-Huu
Date: Sat Sep 01 2007 - 16:19:50 EST


Hello Andrew,

Andrew Morton wrote:
> On Thu, 30 Aug 2007 17:10:03 +0200 (CEST) Jiri Kosina <jkosina@xxxxxxx> wrote:
>> Andrew, do you still strongly oppose to having ARCH_HAS_RANDOMIZE_BRK
>> macro instead please?
>>
>
> Not strongly, but the general opinion seems to be that ARCH_HAS_FOO is
> sucky. It should at least be done in Kconfig rather than in .h, but even
> better is just to implement the thing for all architectures.
>

Sorry for asking again but the initial poster haven't taken time to
answer to my feedbacks...

What about using a weak function in that case ? It actually gives a
default implementation in _one_ place and can be changed easily from
a nop to something more complex later.

Another point is that the current prototype of arch_randomize_brk()
could be slightly improved IMHO.

The proposed prototype is:

void arch_randomize_brk(void)

and I think it could be:

unsigned long randomize_brk(unsigned long brk)

Because the current code of exec syscall is rather.. hmm "tricky",
_hiding_ "current" global usage inside this function is error prone:
if this function is moved later, its use of "current->mm" could
reference the old mm process and it's hard to notice/fix.

thanks,
Franck
-
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/