[File] [PATCH] save/restore full sigaction for SIGPIPE, and only when needed

Christos Zoulas christos at zoulas.com
Tue May 7 02:20:43 UTC 2019


On May 6, 10:30am, dvlasenk at redhat.com (Denys Vlasenko) wrote:
-- Subject: [File] [PATCH] save/restore full sigaction for SIGPIPE, and only 

| file_zmagic() decompresses potentially compressed examined file.
| Since uncompressing tool can fail and writing to closed pipe
| sends SIGPIPE, there is code to disable SIGPIPE.
| 
| It has one problem:
| call to signal() does not save struct sigaction (saves only
| signal handler address), so the restored signal handling can
| be incorrect - e.g. SA_RESTART bit can be different.
| 
| And two missed optimizations:
| = The saving/restoring of SIGPIPE is done even if file turns out
|   to be *not* compressed, and no decompressor is called.
| = If old signal was already SIG_IGN, no need to restore it.
| 
| This causes, for example, ~160000 unnecessary calls
| to rt_sigaction() when rpmbuild generates kernel rpms.

Applied, thanks!

christos


More information about the File mailing list