Skip to content

SEGV is issued while enabling address sanitizer  #6

Description

@eecheng87

To enable the address sanitizer and reproduce the error messages encountered after launching cserv, you can modify the Makefile with the following options:

- CFLAGS += -O2 -g 
+ CFLAGS += -O2 -g -fsanitize=address -static-libasan
- LDFLAGS= -ldl
+ LDFLAGS = -ldl -fsanitize=address -static-libasan

After adding these changes, the following error messages are displayed:

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/coro/sched.c:125 in add_to_timer_node
==18485==ABORTING
AddressSanitizer:DEADLYSIGNAL
=================================================================
==18503==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x5650ef110a5a bp 0x7f47deeabf10 sp 0x7f47deeabed0 T0)
==18503==The signal is caused by a READ memory access.
==18503==Hint: address points to the zero page.
    #0 0x5650ef110a59 in add_to_timer_node src/coro/sched.c:125
    #1 0x5650ef110ccb in move_to_inactive_tree src/coro/sched.c:160
    #2 0x5650ef111485 in schedule_timeout src/coro/sched.c:346
    #3 0x5650ef1153b7 in worker_accept_cycle src/process.c:170
    #4 0x5650ef111325 in coro_routine_proxy src/coro/sched.c:322
    #5 0x5650ef10fe58  (/home/eecheng/cserv/cserv+0x146e58)

Based on the information provided, it is suspected that the error is caused by the casting of the address 0 in the container_of macro. One possible workaround to address this issue is to use a suppression for the address sanitizer, such as the attribute __attribute__((no_sanitize("address"))). You can find more details on how to disable address sanitizer partially in the following link: Disabling Instrumentation with attribute no_sanitize("address").

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