ps 給出分段錯誤

ps 給出分段錯誤

當我嘗試為某個使用者執行簡單的「ps aux」時,出現分段錯誤。如果我以 root 或其他使用者身份運行,它運行良好。所以我認為與 ulimits 有關,但我認為這些參數就足夠了:

bash-4.1$ ulimit -aS
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 128516
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 16384
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 256
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16384
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

bash-4.1$ ps aux
Segmentation fault (core dumped)

我也嘗試用 strace 運行,但我沒有看到任何東西:

bash-4.1$ strace -f -F -v -s 8192 ps aux
...
uname({sysname="Linux", nodename="node1", release="2.6.39-400.215.10.el6uek.x86_64", version="#1 SMP Wed Sep 10 00:07:12 PDT 2014", machine="x86_64"}) = 0
open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 3
read(3, "0-3\n", 8192)                  = 4
close(3)                                = 0
statfs("/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
brk(0)                                  = 0x1daa000
brk(0x1dcb000)                          = 0x1dcb000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_dev=makedev(252, 0), st_ino=408478, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=193600, st_size=99158576, st_atime=2015/05/03-16:54:32, st_mtime=2014/09/03-11:14:03, st_ctime=2014/09/03-11:14:03}) = 0
mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8d56d55000
...
rt_sigaction(SIGTRAP, {0x401ed0, ~[RTMIN RT_1], SA_RESTORER, 0x37ad8326b0}, NULL, 8) = 0
rt_sigaction(SIGILL, {0x401ed0, ~[RTMIN RT_1], SA_RESTORER,     0x37ad8326b0}, NULL, 8) = 0
rt_sigaction(SIGHUP, {0x401ed0, ~[RTMIN RT_1], SA_RESTORER, 0x37ad8326b0}, NULL, 8) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

先致謝!

答案1

嘗試增加使用者堆疊大小,我的 Linux 工作站上的預設值是:

stack size              (kbytes, -s) 8192

相關內容