Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 2 May 2015 05:01:58 +0300
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: [Johnny] Task 1.4.2 fork and OpenMP

Mathieu,

On Thu, Apr 30, 2015 at 02:24:32PM -0400, Mathieu Laprise wrote:
> If we choose the JtR forward sigterm/sigint to its children path, here is
> the code needed. I'm not sure how to submit changes to Solar's cvs repo of
> core john.

Please post any patches against core to this mailing list.

> So I put diff in this website for you to see: left is original,
> right is the new one.
> https://www.diffchecker.com/vhuw1xgn

Thanks.  Going forward, please don't use any pastebins and such (with
the only exception being GitHub, which we currently use anyway).
Instead, please just attach patches, command output, etc. to messages.

> I tested it and it works with Johnny(forkOpenMP branch) or the "top"
> command. However, I'm not a john pro like you guys so I don't know if it
> could have side effects on john that I didn't think of.

It did have side-effects.  (And it deviated from the coding style we use
in JtR.)  Here's a more elaborate patch I committed:

"Forward SIGTERM to --fork'ed children, with a twist as explained in the added
comments.  Thanks to Mathieu Laprise for noticing that this was missing."

http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/john/john/src/signals.c.diff?r1=1.23;r2=1.24

or colored if you like that stuff:

http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/john/john/src/signals.c.diff?r1=1.23;r2=1.24;f=h

Thank you, and I'm sorry for telling you that this functionality was
already in there - I genuinely thought so, misguided by the fact that
normally SIGINT is sent to all processes on the tty.

Now the tricky part: handling of older versions of JtR (before this
patch) in Johnny.  How do you determine which processes to send the
signal to?  One idea is to create a separate process group for each
invocation of JtR.  See setsid(2) and this feature of kill(2):

"If pid is less than -1, then sig is sent to every process in the
process group whose ID is -pid."

That was Linux man page.  POSIX:

"If pid is negative, but not -1, sig shall be sent to all processes
(excluding an unspecified set of system processes) whose process group
ID is equal to the absolute value of pid, and for which the process has
permission to send a signal."

Alexander

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ