This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12155] MALLOC_MMAP_THRESHOLD_ and MALLOC_MMAP_MAX_ (wrongly) have effect in setgid programs


http://sourceware.org/bugzilla/show_bug.cgi?id=12155

--- Comment #2 from Michael Kerrisk <mtk.manpages at gmail dot com> 2010-10-23 14:02:05 UTC ---
Initial runs of test program as normal user. Grepping the strace output of the
second run shows that MALLOC_MMAP_THRESHOLD_ has an effect.

==
$ strace -o o ./t_M_MMAP_THRESHOLD -1 -1 0 1000 100000
$ grep brk o | wc; grep mmap o| wc
    503    1509   26156
      7      56     612
$ MALLOC_MMAP_THRESHOLD_=50000 strace -o o ./t_M_MMAP_THRESHOLD -1 -1 0 1000
100000
$ grep brk o | wc; grep mmap o| wc      3       9     156
   1006    8048   89523
==

Now, run the program first as setuid-root, and then as setgid-root. In the
first case, MALLOC_MMAP_THRESHOLD_ has no effect, but in the second,
MALLOC_MMAP_THRESHOLD_ does have an effect.

==
$ sudo chown root:root t_M_MMAP_THRESHOLD

$ sudo chmod u+s,g-s t_M_MMAP_THRESHOLD
$ ls -l t_M_MMAP_THRESHOLD
-rwsr-xr-x 1 root root 10126 Oct 23 15:32 t_M_MMAP_THRESHOLD

$ MALLOC_MMAP_THRESHOLD_=50000 strace -o o ./t_M_MMAP_THRESHOLD -1 -1 0 1000
100000
$ grep brk o | wc; grep mmap o| wc
    503    1509   26156
      7      56     612

$ sudo chmod u-s,g+s t_M_MMAP_THRESHOLD
$ ls -l t_M_MMAP_THRESHOLD
-rwxr-sr-x 1 root root 10126 Oct 23 15:32 t_M_MMAP_THRESHOLD

$ MALLOC_MMAP_THRESHOLD_=50000 strace -o o ./t_M_MMAP_THRESHOLD -1 -1 0 1000
100000
$ grep brk o | wc; grep mmap o| wc
      3       9     156
   1006    8048   89523
==

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]