All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, oleg@redhat.com, vbabka@suse.cz,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	qiuxishi@huawei.com
Subject: Re: [PATCH v2] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 21:18:59 +0800	[thread overview]
Message-ID: <59355A43.7000706@huawei.com> (raw)
In-Reply-To: <20170605130903.GP9248@dhcp22.suse.cz>

On 2017/6/5 21:09, Michal Hocko wrote:
> On Mon 05-06-17 20:53:27, zhongjiang wrote:
>> diff --git a/kernel/signal.c b/kernel/signal.c
>> index ca92bcf..63148f7 100644
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -1395,6 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  
>>  	read_lock(&tasklist_lock);
>>  	if (pid != -1) {
>> +		/*
>> +	 	 * -INT_MIN is undefined, it need to exclude following case to 
>> + 		 * avoid the UBSAN detection.
>> +		 */
>> +		if (pid == INT_MIN)
>> +			return -ESRCH;
> this will obviously keep the tasklist_lock held...
 oh, it is my fault.   Thank you for clarify.

 Thanks
zhongjiang
>>  		ret = __kill_pgrp_info(sig, info,
>>  				pid ? find_vpid(-pid) : task_pgrp(current));
>>  	} else {
>> -- 
>> 1.7.12.4


--
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: Michal Hocko <mhocko@kernel.org>
Cc: <akpm@linux-foundation.org>, <oleg@redhat.com>, <vbabka@suse.cz>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<qiuxishi@huawei.com>
Subject: Re: [PATCH v2] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 21:18:59 +0800	[thread overview]
Message-ID: <59355A43.7000706@huawei.com> (raw)
In-Reply-To: <20170605130903.GP9248@dhcp22.suse.cz>

On 2017/6/5 21:09, Michal Hocko wrote:
> On Mon 05-06-17 20:53:27, zhongjiang wrote:
>> diff --git a/kernel/signal.c b/kernel/signal.c
>> index ca92bcf..63148f7 100644
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -1395,6 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>>  
>>  	read_lock(&tasklist_lock);
>>  	if (pid != -1) {
>> +		/*
>> +	 	 * -INT_MIN is undefined, it need to exclude following case to 
>> + 		 * avoid the UBSAN detection.
>> +		 */
>> +		if (pid == INT_MIN)
>> +			return -ESRCH;
> this will obviously keep the tasklist_lock held...
 oh, it is my fault.   Thank you for clarify.

 Thanks
zhongjiang
>>  		ret = __kill_pgrp_info(sig, info,
>>  				pid ? find_vpid(-pid) : task_pgrp(current));
>>  	} else {
>> -- 
>> 1.7.12.4

  reply	other threads:[~2017-06-05 13:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 12:53 [PATCH v2] signal: Avoid undefined behaviour in kill_something_info zhongjiang
2017-06-05 12:53 ` zhongjiang
2017-06-05 13:09 ` Michal Hocko
2017-06-05 13:09   ` Michal Hocko
2017-06-05 13:18   ` zhong jiang [this message]
2017-06-05 13:18     ` zhong jiang
2017-06-05 13:31 ` Oleg Nesterov
2017-06-05 13:31   ` Oleg Nesterov
2017-06-05 13:46   ` zhong jiang
2017-06-05 13:46     ` 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=59355A43.7000706@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=oleg@redhat.com \
    --cc=qiuxishi@huawei.com \
    --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.