All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: akpm@linux-foundation.org, stsp@list.ru, Waiman.Long@hpe.com,
	mingo@kernel.org, mhocko@kernel.org, vbabka@suse.cz,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	qiuxishi@huawei.com
Subject: Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 20:47:47 +0800	[thread overview]
Message-ID: <593552F3.4040407@huawei.com> (raw)
In-Reply-To: <20170605123744.GA9807@redhat.com>

On 2017/6/5 20:37, Oleg Nesterov wrote:
> On 06/05, zhongjiang wrote:
>>  static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  {
>> -	int ret;
>> +	int ret, vpid;
>>  
>>  	if (pid > 0) {
>>  		rcu_read_lock();
>> @@ -1395,8 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  
>>  	read_lock(&tasklist_lock);
>>  	if (pid != -1) {
>> +		if (pid == INT_MIN)
>> +			vpid = INT_MAX;
> Well, this probably needs a comment to explain that this is just "avoid ub".
>
> And if we really want the fix, to me
>
> 	if (pid == INT_MIN)
> 		return -ESRCH;
>
> at the start makes more sense...
>
> Oleg.
>
>
> .
>
 ok, I will motify it in v2 shortly,  Thanks

 Regards
zhongjiang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: zhong jiang <zhongjiang@huawei.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: <akpm@linux-foundation.org>, <stsp@list.ru>,
	<Waiman.Long@hpe.com>, <mingo@kernel.org>, <mhocko@kernel.org>,
	<vbabka@suse.cz>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <qiuxishi@huawei.com>
Subject: Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 20:47:47 +0800	[thread overview]
Message-ID: <593552F3.4040407@huawei.com> (raw)
In-Reply-To: <20170605123744.GA9807@redhat.com>

On 2017/6/5 20:37, Oleg Nesterov wrote:
> On 06/05, zhongjiang wrote:
>>  static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  {
>> -	int ret;
>> +	int ret, vpid;
>>  
>>  	if (pid > 0) {
>>  		rcu_read_lock();
>> @@ -1395,8 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  
>>  	read_lock(&tasklist_lock);
>>  	if (pid != -1) {
>> +		if (pid == INT_MIN)
>> +			vpid = INT_MAX;
> Well, this probably needs a comment to explain that this is just "avoid ub".
>
> And if we really want the fix, to me
>
> 	if (pid == INT_MIN)
> 		return -ESRCH;
>
> at the start makes more sense...
>
> Oleg.
>
>
> .
>
 ok, I will motify it in v2 shortly,  Thanks

 Regards
zhongjiang

  reply	other threads:[~2017-06-05 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05  9:11 [PATCH] signal: Avoid undefined behaviour in kill_something_info zhongjiang
2017-06-05  9:11 ` zhongjiang
2017-06-05 12:37 ` Oleg Nesterov
2017-06-05 12:37   ` Oleg Nesterov
2017-06-05 12:47   ` zhong jiang [this message]
2017-06-05 12:47     ` zhong jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=593552F3.4040407@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=Waiman.Long@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=qiuxishi@huawei.com \
    --cc=stsp@list.ru \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.