Nmap Development mailing list archives
Re: [Patch] Runtime interaction bug with sudo
From: Jay Bosamiya <jaybosamiya () gmail com>
Date: Thu, 15 May 2014 21:26:43 +0530
Hi Patrick, I read through all 3 links and rewrote the patch.It now doesn't use exit but restores the default handler and raises the signal again (after calling tty_done).
Core dump generation is preserved. I tested that using `ulimit -c unlimited; sudo nmap 127.0.0.1 -p-` and then pressing Ctrl-\
One thing I'm not so sure of is the handlers for SIGPIPE, SIGHUP and SIGXFSZ being set to SIG_IGN. That's why I haven't included them in the patch, even though its there in the code you had written ([3] in your mail).
Other than that, the patch seems to work perfectly for all the tests I ran against it on my Ubuntu 14.04 machine.
I would appreciate it, if you could give any feedback for further improvement; otherwise, I think that the patch can be committed.
Cheers, Jay Attached: The new patch. On Wednesday 14 May 2014 07:56 PM, Patrick Donnelly wrote:
exit is not an "async-signal-safe" function as defined by [1]. The main reason for this is because it calls fflush on all open files. Calling tty_done directly from the signal handler would be okay though. [Although, technically, changing tty_fd in tty_done is not technically correct in a signal handler since its type is not sig_atomic_t.] Then you could call _exit [2] (which is async-signal-safe). Any solution to this should preserve the abnormal termination of Nmap. That is, the default signal handler should be restored and the signal raised again. The main reason for this is to preserve the generation of core dumps. You can look at an example solution I wrote for another program here [3]. [1]http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html [2]http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html [3]https://github.com/cooperative-computing-lab/cctools/blob/master/chirp/src/chirp_server.c#L1893
Attachment:
keyStrokeGrabbing.patch.new
Description:
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [Patch] Runtime interaction bug with sudo Jay Bosamiya (May 06)
- Re: [Patch] Runtime interaction bug with sudo Patrick Donnelly (May 14)
- Re: [Patch] Runtime interaction bug with sudo Jay Bosamiya (May 15)
- Re: [Patch] Runtime interaction bug with sudo Patrick Donnelly (May 15)
- Re: [Patch] Runtime interaction bug with sudo Daniel Miller (May 15)
- Re: [Patch] Runtime interaction bug with sudo Daniel Miller (May 21)
- Re: [Patch] Runtime interaction bug with sudo Jay Bosamiya (May 15)
- Re: [Patch] Runtime interaction bug with sudo Patrick Donnelly (May 14)