Re: [PATCH 7/9] tests: check kill all user processes

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

 



On 04/20/2014 11:53 AM, Sami Kerola wrote:
> On 16 April 2014 11:13, Karel Zak <kzak@xxxxxxxxxx> wrote:
>> On Tue, Apr 15, 2014 at 12:15:33PM +0100, Sami Kerola wrote:
>>> +HELPER_SYMLINK="$TS_CWD/$(mktemp -u XXXXXXXXXXXXXXX)"
>>> +ln -s "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
>>> +trap "rm -f $HELPER_SYMLINK" 0
>>> +
>>> +su nobody -s /bin/sh -c "$HELPER_SYMLINK $TS_CWD/nobody" >> "$TS_OUTPUT" 2>&1 &
>>
>> I don't understand this idea, on my system Mr.Nobody can not write
>> to my directories.
>>
>> It would be also better to add --setgit and --setuid to the helper to
>> avoid extra su(1) process, then you can use TEST_PID=$!
> 
> The --setuid is added, [...]

yes, setuid is a great idea, yet I'm not sure
if using UID 1 is a good idea:

		if (setuid(1) < 0)
			err(TEST_SIGRECEIVE_FAILURE, "setuid failed");

Doesn't everyone hack&build under his own private user account?
So maybe that would be the best choice (if the kill-test doesn't
kill random processes of the user.
Anyone a better idea?

>>> +# test_sigreceive needs time to start up
>>> +for i in 0.01 0.1 1 1 1 1; do
>>> +     test -f "$TS_CWD/nobody" && { up=1; break; }
>>> +     sleep $i
>>> +done
>>
>> The question is if we really need to use the PID files. Would be
>> possible to use test_sigreceive that does not write anything?
>>
>> You can for example to use
>>
>>    awk '/SigCgt/ { print $2}' /proc/<pid>/status
>>
>> to check if the signal handlers are already initialized (the final
>> mask is 800000027ffbfeff on my system).


> That is a much better way to determine if the process is ready to be
> killed. Implemented in my git, and I have only one remaining question.

I'm not a big fan of magic numbers. Is there a chance to narrow down
the relevant bits?

Have a nice day,
Berny
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux