gpt4 book ai didi

c - Linux ps命令核心随机

转载 作者:行者123 更新时间:2023-11-30 17:13:23 25 4
gpt4 key购买 nike

在对特定进程 ID 进行 ps 时,我随机观察到段错误。 pid 指向的进程在执行 ps {pid} 期间已启动并正在运行

回溯:

(gdb) bt
#0 reset_global () at ps/global.c:362
#1 0x0000000000402456 in main (argc=2, argv=0x7ffe02d33fa8) at ps/display.c:578 (gdb)

at ps/global.c:362 there is a call to look_up_our_self(&p);

359         void reset_global(void){
360 static proc_t p;
361 reset_selection_list();
362 look_up_our_self(&p);
363 set_screen_size();
364 set_personality();
365 int fd;
366 char *buf[BUFFSIZE];

disassemble out put.

gdb) disassemble

0x000000000040315a <+74>: callq 0x401930 <free@plt>
0x000000000040315f <+79>: test %rbp,%rbp
0x0000000000403162 <+82>: jne 0x403148 <reset_global+56>
0x0000000000403164 <+84>: lea 0x10(%rsp),%rbx
0x0000000000403169 <+89>: mov $0x635860,%edi
0x000000000040316e <+94>: movq $0x0,0x21253f(%rip) # 0x6156b8 <selection_list>
=> 0x0000000000403179 <+105>: callq 0x401a60 <look_up_our_self@plt>
0x000000000040317e <+110>: xor %eax,%eax
0x0000000000403180 <+112>: mov %rbx,%rdx
0x0000000000403183 <+115>: mov $0x5413,%esi
0x0000000000403188 <+120>: mov $0x1,%edi
0x000000000040318d <+125>: callq 0x4017f0 <ioctl@plt>
0x0000000000403192 <+130>: cmp $0xffffffffffffffff,%eax

Registers

(gdb) info registers
rax 0xdeadbeef 3735928559
rbx 0x7ffe02cb3d50 140728945294672
rcx 0x0 0
rdx 0x0 0
rsi 0x7ffe02d33ce0 140728945818848
rdi 0x635860 6510688
rbp 0x7ffe02d33df0 0x7ffe02d33df0
rsp 0x7ffe02cb3d40 0x7ffe02cb3d40
r8 0x0 0
r9 0x1 1
r10 0x8 8
r11 0x206 518
r12 0x2 2
r13 0x7ffe02d33fa8 140728945819560
r14 0x0 0
r15 0x0 0
rip 0x403179 0x403179 <reset_global+105>
eflags 0x10246 [ PF ZF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb)

update: maps output:

00400000-00416000 r-xp 00000000 00:11 6116
/bin/ps 00615000-00616000 rw-p 00015000 00:11 6116
/bin/ps 00616000-00636000 rw-p 00000000 00:00 0 7ffe0258d000-7ffe026e1000 r-xp 00000000 00:11 8166
/lib64/libc-2.11.1.so 7ffe026e1000-7ffe028e1000 ---p 00154000 00:11 8166 /lib64/libc-2.11.1.so 7ffe028e1000-7ffe028e5000 r--p 00154000 00:11 8166
/lib64/libc-2.11.1.so 7ffe028e5000-7ffe028e6000 rw-p 00158000 00:11 8166 /lib64/libc-2.11.1.so 7ffe028e6000-7ffe028eb000 rw-p 00000000 00:00 0 7ffe028eb000-7ffe028ed000 r-xp 00000000 00:11 8175
/lib64/libdl-2.11.1.so 7ffe028ed000-7ffe02aed000 ---p 00002000 00:11 8175 /lib64/libdl-2.11.1.so 7ffe02aed000-7ffe02aee000 r--p 00002000 00:11 8175
/lib64/libdl-2.11.1.so 7ffe02aee000-7ffe02aef000 rw-p 00003000 00:11 8175 /lib64/libdl-2.11.1.so 7ffe02aef000-7ffe02afe000 r-xp 00000000 00:11 8213
/lib64/libproc-3.2.8.so 7ffe02afe000-7ffe02cfe000 ---p 0000f000 00:11 8213 /lib64/libproc-3.2.8.so 7ffe02cfe000-7ffe02cff000 rw-p 0000f000 00:11 8213
/lib64/libproc-3.2.8.so 7ffe02cff000-7ffe02d13000 rw-p 00000000 00:00 0 7ffe02d14000-7ffe02d35000 rw-p 00000000 00:00 0
[stack] 7ffe02d7f000-7ffe02d80000 r-xp 00000000 00:00 0
[vdso] 7ffe02eaa000-7ffe02ec8000 r-xp 00000000 00:11 8156
/lib64/ld-2.11.1.so 7ffe030b9000-7ffe030bc000 rw-p 00000000 00:00 0 7ffe030c6000-7ffe030c7000 rw-p 00000000 00:00 0 7ffe030c7000-7ffe030c8000 r--p 0001d000 00:11 8156
/lib64/ld-2.11.1.so 7ffe030c8000-7ffe030c9000 rw-p 0001e000 00:11 8156 /lib64/ld-2.11.1.so 7ffe030c9000-7ffe030ca000 rw-p 00000000 00:00 0 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]

最佳答案

请查找下面的 proc/map 文件内容以了解上述段错误:代表 Guruswamy Basavaiah

    00400000-00416000 r-xp 00000000 00:11 6116                               /bin/ps
00615000-00616000 rw-p 00015000 00:11 6116 /bin/ps
00616000-00636000 rw-p 00000000 00:00 0
7ffe0258d000-7ffe026e1000 r-xp 00000000 00:11 8166 /lib64/libc-2.11.1.so
7ffe026e1000-7ffe028e1000 ---p 00154000 00:11 8166 /lib64/libc-2.11.1.so
7ffe028e1000-7ffe028e5000 r--p 00154000 00:11 8166 /lib64/libc-2.11.1.so
7ffe028e5000-7ffe028e6000 rw-p 00158000 00:11 8166 /lib64/libc-2.11.1.so
7ffe028e6000-7ffe028eb000 rw-p 00000000 00:00 0
7ffe028eb000-7ffe028ed000 r-xp 00000000 00:11 8175 /lib64/libdl-2.11.1.so
7ffe028ed000-7ffe02aed000 ---p 00002000 00:11 8175 /lib64/libdl-2.11.1.so
7ffe02aed000-7ffe02aee000 r--p 00002000 00:11 8175 /lib64/libdl-2.11.1.so
7ffe02aee000-7ffe02aef000 rw-p 00003000 00:11 8175 /lib64/libdl-2.11.1.so
7ffe02aef000-7ffe02afe000 r-xp 00000000 00:11 8213 /lib64/libproc-3.2.8.so
7ffe02afe000-7ffe02cfe000 ---p 0000f000 00:11 8213 /lib64/libproc-3.2.8.so
7ffe02cfe000-7ffe02cff000 rw-p 0000f000 00:11 8213 /lib64/libproc-3.2.8.so
7ffe02cff000-7ffe02d13000 rw-p 00000000 00:00 0
7ffe02d14000-7ffe02d35000 rw-p 00000000 00:00 0 [stack]
7ffe02d7f000-7ffe02d80000 r-xp 00000000 00:00 0 [vdso]
7ffe02eaa000-7ffe02ec8000 r-xp 00000000 00:11 8156 /lib64/ld-2.11.1.so
7ffe030b9000-7ffe030bc000 rw-p 00000000 00:00 0
7ffe030c6000-7ffe030c7000 rw-p 00000000 00:00 0
7ffe030c7000-7ffe030c8000 r--p 0001d000 00:11 8156 /lib64/ld-2.11.1.so
7ffe030c8000-7ffe030c9000 rw-p 0001e000 00:11 8156 /lib64/ld-2.11.1.so
7ffe030c9000-7ffe030ca000 rw-p 00000000 00:00 0
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

关于c - Linux ps命令核心随机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30884627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com