Opened 17 years ago

Last modified 4 years ago

#654 new enhancement

Check for async-signal-unsafe functions

Reported by: Markus Elfring Owned by: noone
Priority: Normal Milestone:
Component: New check Version:
Keywords: signalHandler atomicDataAccess Cc: php-coderrr, Kamil Dudka

Description (last modified by amai)

A signal handler implementation must adhere to strict requirements.

Would you like to add a search capability for the property "async-signal-safety" in the source files if the rules were broken?

Change History (8)

comment:1 by php-coderrr, 17 years ago

Cc: php-coderrr added

comment:2 by Kamil Dudka, 13 years ago

Cc: Kamil Dudka added
Priority: Normal

comment:3 by amai, 13 years ago

That might be useful, though quite difficult to implement in cppcheck:

  1. The signal handler has to be registered in the same source than the handler is implemented /defined - so cppcheck can analyze
  2. The list of system functions to be called is white-listed if I understand the referenced specification - making it hard to detect the invalid ones.
  3. cppcheck might not know about user code functions to be called from the signal handler

comment:4 by orbitcowboy, 9 years ago

Component: New checkOther
Keywords: signalHandler atomicDataAccess added; signal handler atomic data access removed

in reply to:  3 comment:5 by amai, 9 years ago

Description: modified (diff)

Replying to amai:

That might be useful, though quite difficult to implement in cppcheck:

  1. The signal handler has to be registered in the same source than the handler is implemented /defined - so cppcheck can analyze

Ok, that requirement got removed recently. The whitelist is available within the given external resource.

comment:6 by chrchr, 4 years ago

Component: OtherNew check

comment:7 by kidkat, 4 years ago

FYI clang-tidy has the bugprone-signal-handler check nowadays and is soon landing some major improvements to it.

See
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/signal-handler.html
https://reviews.llvm.org/D118996

Note: See TracTickets for help on using tickets.