[lkml]   [2008]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: brk randomization breaks columns
On Mon, 4 Feb 2008, Jiri Kosina wrote:

> I still don't seem to fully understand what is happening here --
> aparently this is triggerable only with old programs linked against
>, and I am not able to trigger it with my trivial program when
> I link it against old, which just basically does brk() and
> checks whether /proc/<pid>/maps are OK. Seems to me that (at least
> certain versions) of (wrongly) assume that end of the bss is
> the start of the heap, but I will try to investigate it more.

And I really think that (at least Pavel's version of) is making
some strange assumptions about memory layout of the process, which could
also explain the other failures.

Pavel, could you please link the source code below against with
brk randomization turned on, and show the output, and if it segfaults,
send the backtrace at the time of the crash? I suspect that it will crash
somewhere in exit path when calling .dtor functions, as it will try to
perform some cleanup in unmapped area. Thanks.

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main()
int *curr_brk = sbrk(0);
char command[1024];

sprintf(command, "/bin/cat /proc/%d/maps", getpid());

printf("brk set to %p\n", curr_brk);

brk(curr_brk + 0x00001000);
curr_brk = sbrk(0);

printf("brk set to %p\n", curr_brk);

Jiri Kosina

 \ /
  Last update: 2008-02-04 17:15    [W:0.080 / U:5.824 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site