public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.28.4 regression: mmap fails if mlockall used
@ 2009-02-08 10:52 Sami Farin
  2009-02-08 18:25 ` Hugh Dickins
  0 siblings, 1 reply; 7+ messages in thread
From: Sami Farin @ 2009-02-08 10:52 UTC (permalink / raw)
  To: Linux kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

2.6.28.2 + gcc-4.3.2-7 works.
2.6.28.4 + gcc-4.4.0-0.16 does not work.
I run x86_64 SMP kernel.

# strace ./a.out ntp
12:10:14.780726 mmap(NULL, 2147624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = -1 EFAULT (Bad address) <0.000038>
12:10:14.780809 close(3)                = 0 <0.000012>
12:10:14.780856 munmap(0x7f3476e0d000, 421232) = 0 <0.000145>
12:10:14.781054 write(2, "./a.out: getpwnam failed: Success\n"..., 34./a.out: getpwnam failed: Success
) = 34 <0.000015>

I can do malloc(3000000), then mmap call is
12:50:20.694207 mmap(NULL, 3002368, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8a8d16b000 <0.003078>

-- 
"When playing Russian roulette, the fact that the first shot
 got off safely is little comfort for the next." - Richard Feynman


[-- Attachment #2: getpw.c --]
[-- Type: text/plain, Size: 645 bytes --]

#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include <sys/mman.h>

int main(int argc, char *argv[])
{
  struct passwd *pw;

  if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
    fprintf(stderr, "%s: mlockall failed: %s\n",
            argv[0], strerror(errno));
  }
  if (argc != 2) return 1;
  errno = 0;
  pw = getpwnam(argv[1]);
  if (pw == NULL) {
    fprintf(stderr, "%s: getpwnam failed: %s\n",
            argv[0], strerror(errno));
    return 1;
  }
  fprintf(stdout, "uid=%u gid=%u\n",
          (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid);
  fflush(stdout);
  return 0;
}


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-11 21:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-08 10:52 2.6.28.4 regression: mmap fails if mlockall used Sami Farin
2009-02-08 18:25 ` Hugh Dickins
2009-02-08 19:23   ` Sami Farin
2009-02-08 20:56     ` Hugh Dickins
2009-02-11  6:55       ` Doug Bazarnic
2009-02-11 18:34         ` Hugh Dickins
2009-02-11 21:56           ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox