From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbdFENq7 (ORCPT ); Mon, 5 Jun 2017 09:46:59 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6869 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbdFENqb (ORCPT ); Mon, 5 Jun 2017 09:46:31 -0400 Message-ID: <5935609A.3080303@huawei.com> Date: Mon, 5 Jun 2017 21:46:02 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Oleg Nesterov CC: , , , , , Subject: Re: [PATCH v2] signal: Avoid undefined behaviour in kill_something_info References: <1496667207-56723-1-git-send-email-zhongjiang@huawei.com> <20170605133159.GA10301@redhat.com> In-Reply-To: <20170605133159.GA10301@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.593560B4.00A6,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8f2c32a58fbc4c6e63b125954ad46de7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/6/5 21:31, Oleg Nesterov wrote: > On 06/05, zhongjiang wrote: >> --- 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; > you need to do this before read_lock(tasklist) > > Oleg. > > > . > I am so sorry for disturbing. Thanks zhongjiang