简体   繁体   中英

Linux perf not resolving some symbols with high addresses starting with 0xffffffff

g++ -std=c++17 -fno-omit-frame-pointer -O0 -g3 -o main main.cpp
perf stat ./main 5
perf report
  20.98%  main     [unknown]         [k] 0xffffffffb1077f22                                          ◆
  19.11%  main     main              [.] func                                                        ▒
  17.96%  main     libc-2.31.so      [.] __memset_avx2_erms                                          ▒
  13.07%  main     [unknown]         [k] 0xffffffffb067a936                                          ▒
   5.75%  main     [unknown]         [k] 0xffffffffb10e68e5                                          ▒
   3.30%  main     main              [.] std::min<int>                                               ▒
   1.72%  main     [unknown]         [k] 0xffffffffb1077f25                                          ▒
   1.58%  main     [unknown]         [k] 0xffffffffb086f485                                          ▒
   1.01%  main     main              [.] std::max<int>   

func is a symbol in main.cpp, so symbols in my source file have been resolved. I call std::max and memset , they have beed resolved, too. But what about 0xffffffffb1077f22 , it is an address. And with nm main , I'm sure that it is not a symbol in main source file. What is it? I don't think it is a library function because memset and std::max can be resolved.

I run perf in ubuntu virtual machine of macos.

I did not give attention to the warning message of perf report . It says:

WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
check /proc/sys/kernel/kptr_restrict and /proc/sys/kernel/perf_event_paranoid.

So it seemed that I should set a proper value in /proc/sys/kernel/kptr_restrict.

sudo echo 0 > /proc/sys/kernel/kptr_restrict

Then the address can be resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM