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

相关内容