lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081226144928.GC3156@hack.private>
Date:	Fri, 26 Dec 2008 14:49:28 +0000
From:	Américo Wang <xiyou.wangcong@...il.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Américo Wang <xiyou.wangcong@...il.com>,
	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...l.org>
Subject: Re: [Patch] signal: let valid_signal() check more

On Thu, Dec 25, 2008 at 07:00:54PM +0100, Oleg Nesterov wrote:
>On 12/26, Américo Wang wrote:
>>
>> Teach valid_signal() to check sig > 0 case.
>
>Why?

Just to simplify the checking.

>
>> @@ -727,7 +727,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
>>  	{
>>  		if (!perm || !capable(CAP_KILL))
>>  			goto eperm;
>> -		if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
>> +		if (!valid_signal((int)arg) || arg == SIGKILL)
>                                  ^^^^^
>
>The patch adds a lot of unnecessary typecasts like this.


because it's inline?

>
>> -static inline int valid_signal(unsigned long sig)
>> +static inline int valid_signal(int sig)
>>  {
>> -	return sig <= _NSIG ? 1 : 0;
>> +	return sig <= _NSIG ? (sig > 0) : 0;
>>  }
>
>This looks a bit strange, why not
>
>	return sig > 0 && sig <= _NSIG;
>
>?


Yes, this one is better.

>
>But, more importantly, I don't think the patch is correct.
>
>Unless I misread the patch, now kill(pid, 0) returns -EINVAL, no?
>
>And we have other users of valid_signal() which assume that sig == 0
>is OK, for example arch_ptrace().


Oh, thanks for pointing this out. I didn't know this. Sorry.

>
>Imho, the patch has a point, but perhaps it is better to add the
>new helper and then convert the users which do something like
>
>	if (valid_signal(sig) && sig)
>		...
>
>What do you think?

I think this is a good idea. I will do it.

Thanks.

-- 
"Against stupidity, the gods themselves, contend in vain."

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ