WSL: ps aux - Ssps:display.c:66: please report this bug Segmentation fault (core dumped)

  • Your Windows build number: 10.0.17134.1

  • What you’re doing and what’s happening:

user@mymachine:~$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   8304   104 ?        Ss   Jun04   0:01 /init ro
<...removed some rows...>
Signal 11 (SEGV) caught by ps (procps-ng version 3.3.10).
root     15472  0.0  0.0  19568  1120 ?        Ssps:display.c:66: please report this bug
Segmentation fault (core dumped)
  • What’s wrong / what should be happening instead:

ps output without errors

  • Strace of the failing command, if applicable:

This is the tail output of the command - strace -v -s 256 ps aux

stat("/etc/localtime", {st_dev=makedev(0, 2), st_ino=281474977023961, st_mode=S_IFREG|0644, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=1129, st_atime=2018/02/04-16:23:13.751519800, st_mtime=2018/05/14-12:15:13.707070500, st_ctime=2018/05/14-12:15:13.707070500}) = 0
stat("/etc/localtime", {st_dev=makedev(0, 2), st_ino=281474977023961, st_mode=S_IFREG|0644, st_nlink=2, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=1129, st_atime=2018/02/04-16:23:13.751519800, st_mtime=2018/05/14-12:15:13.707070500, st_ctime=2018/05/14-12:15:13.707070500}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1c} ---
write(2, "Signal 11 (SEGV) caught by ps (procps-ng version 3.3.10).\n", 58) = 58
write(1, "root     15472  0.0  0.0  19568  1120 ?        Ss", 49) = 49
write(2, "ps:", 3)                      = 3
write(2, "display.c:66: ", 14)          = 14
write(2, "please report this bug", 22)  = 22
write(2, "\n", 1)                       = 1
rt_sigaction(SIGSEGV, {SIG_DFL, [SEGV], SA_RESTORER|SA_RESTART, 0x7f78f8e254b0}, {0x403220, ~[RTMIN RT_1], SA_RESTORER, 0x7f78f8e254b0}, 8) = 0
kill(16100, SIGSEGV)                    = 0
rt_sigreturn({mask=[]} <unfinished ...>
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_USER, si_pid=16100, si_uid=1000} ---
+++ killed by SIGSEGV (core dumped) +++

I can send the full output to secure@microsoft.com if needed.

It seems the same error as #1649, but I’m not sure this is the same cause.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Pretty cool fail. That’s the 16th of December in the year 5,845,542,510 (it’s a Tuesday) best I can tell. About six billion years from now. I mean, the Sun will have exhausted all it’s hydrogen by then. But I don’t see why WSL shouldn’t still run. Seem like a bug to me.

I came here via: https://bugs.python.org/issue33965

So others can find this more quickly, this is the error message it started with:

Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time
OverflowError: timestamp too large to convert to C _PyTime_t

It looks like some processes have a ridiculously large start_time:

$ cat /proc/10606/stat
10606 (ssh-agent) S 1 10606 10606 0 0 0 0 0 0 0 0 0 0 0 20 0 1 0 18446744073637939154 904584650752 79 18446744073709551615 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Then the crash occurs when ps takes this value and tries to pass it to localtime, but doesn’t check the return value of localtime…

...
1018      t = getbtime() + pp->start_time / Hertz;
1019      proc_time = localtime(&t);
...
(gdb) p pp->start_time
$1 = 18446744073637939154
(gdb) p Hertz
$2 = 100
(gdb) p t
$3 = 184467442265061305
(gdb) p proc_time
$4 = (struct tm *) 0x0

#1649 (appreciate the ref) was deemed addressed so you’re correct to open a new one. Thanks.

@jstarks and I took a look at this yesterday and determined that our boot time calculation could overflow if your machine is running for a long time (a few weeks). Essentially what happens is our instance boot time overflows, so any relative calculations based off the boot time (like process creation time) will be way off. Working on a fix for this now.