Common mistakes in writing signal handler, or fault handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just want to share this.

First, at:

http://tuxology.net/lectures/crash-and-burn-writing-linux-application-fault-handlers/

At page 6, is the common practise of capturing the stacktrace,
whenever error occurred.   But this is actually wrong, and will give
rise to race condition.

Inside the signal/fault handler, there are many scenario which may
give rise to memory allocation.   POSIX C has defined a list of
async-safe function, and if implementation is correct, these functions
are not supposed to allocate memory, and thus can be safely used
inside a signal handler.

Good examples of non-async safe functions are backtrace(), and
printf().   But write(), and open() are async safe, and should be used
for I/O instead - after taking care of locks etc in multi-core
scenario.

Essentially all the problems are summarized in page 17, and the rest
of slides is expanding on that.

Share your comments.





-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux