Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1657570

Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info

From zhong jiang <zhongjiang@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info
Date 2017-06-05 14:50 +0200
Message-ID <tOZCi-2X2-13@gated-at.bofh.it> (permalink)
References <tOWl4-12Q-23@gated-at.bofh.it> <tOZsC-2TL-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] signal: Avoid undefined behaviour in kill_something_info zhongjiang <zhongjiang@huawei.com> - 2017-06-05 11:20 +0200
  Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info Oleg Nesterov <oleg@redhat.com> - 2017-06-05 14:40 +0200
    Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info zhong jiang <zhongjiang@huawei.com> - 2017-06-05 14:50 +0200

csiph-web