From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbdFENcL (ORCPT ); Mon, 5 Jun 2017 09:32:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53546 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbdFENcE (ORCPT ); Mon, 5 Jun 2017 09:32:04 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C094C37EEE Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C094C37EEE Date: Mon, 5 Jun 2017 15:31:59 +0200 From: Oleg Nesterov To: zhongjiang Cc: akpm@linux-foundation.org, mhocko@kernel.org, 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 Message-ID: <20170605133159.GA10301@redhat.com> References: <1496667207-56723-1-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1496667207-56723-1-git-send-email-zhongjiang@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 05 Jun 2017 13:32:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.