Skip to content

PLT hook segfault about GCC 7 #3

@JIMyungSik

Description

@JIMyungSik

gcc 5.4.1에서 빌드된 uftrace는 이 문제가 없습니다.
하지만 gcc 7.0.1에서 빌드하면 아래처럼 PLT(Procedure Linkage Table) 후크에 대한 세그멘테이션 오류(메모리 기법에 대한 오류)가 발생합니다.

# normal tracing

$ uftrace tests/t-abc
WARN: invalid task file
child terminated by signal: 11: Segmentation fault
# DURATION    TID     FUNCTION
But if using --no-libcall, the segmentation fault didn't appear.

$ uftrace --no-libcall t-abc
# DURATION    TID     FUNCTION
            [ 5133] | main() {
            [ 5133] |   a() {
            [ 5133] |     b() {
   0.982 us [ 5133] |       c();
   1.854 us [ 5133] |     } /* b */
   2.170 us [ 5133] |   } /* a */
   2.792 us [ 5133] | } /* main */

파일을 확인하면, libmcount/plthook.c에서 429번째 줄에서 확인할 수 있습니다.

Reading symbols from t-abc...(no debugging symbols found)...done.
[New LWP 5249]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `t-abc'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ff5a1b8a322 in plthook_entry (ret_addr=0x7ffd79fb0378, child_idx=1, 
    module_id=140692961395048, regs=0x7ffd79fb0338)
    at /home/taeung/git/uftrace/libmcount/plthook.c:429
429		struct ftrace_trigger tr = {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions