From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C340E28C2BF for ; Mon, 16 Mar 2026 11:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773661927; cv=none; b=SwU9C+vyEXmmohIO80xwO0hEsAxRnM1yGAosJ99luZmw52PFPD1t83arkKCV1LmjsmTd2rZoZvC+2r6IM/REsVXgOWVt6xJknoGx4vALWyLun7z5rFYipmCzW4eR+RnQVPrICIFigbxg5PcxDLLEet94c9G8pVZ6aOR4iGmVJxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773661927; c=relaxed/simple; bh=B/MdxZzHhDNb3516/vDEYOU5A9Oe3iNWfxJ2fDKJeaE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c4Ki5H3Svv+sV723VnICFGPwBlfH6daKExEsBxeYKS8a7Xi36rwR5yDBD2FxyxOHVBJHnNH7OuGNM75unOLc5Eaw6WEJdf7gB+qErtOvEW99pYlnGlF5o34c1AWNrGMJ+WJAOs4zL9qWVFItOXjh3IVprA2wP0+s597KFt+s5Mo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YQ32lSqn; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YQ32lSqn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773661925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iMMpP2PlqEQrh0LsuT2QxskC9rMBKcARY/PvEZa5MQc=; b=YQ32lSqng/k5uLuT1aSiKkUNAHwyQayfhmpL/reU8qL4TNstEK+M7VWMpn/hDv6mLcXNQe 8+KLJrbVbapnKrfeGKyRe6zcoe5yv5mgdnyLAnxQcE/nn/4dio2UD5ckDD8UZx6Ue0TOuS F3J+YE6xweV3ngQ24Z3onN78ms9vSHs= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-Esin8boYNg2gUyOr0f2cXA-1; Mon, 16 Mar 2026 07:52:01 -0400 X-MC-Unique: Esin8boYNg2gUyOr0f2cXA-1 X-Mimecast-MFC-AGG-ID: Esin8boYNg2gUyOr0f2cXA_1773661918 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 41DAA1884EC3; Mon, 16 Mar 2026 11:51:38 +0000 (UTC) Received: from fedora (unknown [10.45.225.204]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id C67D930002DC; Mon, 16 Mar 2026 11:51:27 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 16 Mar 2026 12:51:36 +0100 (CET) Date: Mon, 16 Mar 2026 12:51:26 +0100 From: Oleg Nesterov To: Deepanshu Kartikey Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kees@kernel.org, akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, brauner@kernel.org, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzbot+bbe6b99feefc3a0842de@syzkaller.appspotmail.com Subject: Re: [PATCH v2] kernel/fork: validate exit_signal in kernel_clone() Message-ID: References: <20260316104536.558108-1-kartikey406@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260316104536.558108-1-kartikey406@gmail.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Deepanshu, Let me repeat, the changelog should be updated. On 03/16, Deepanshu Kartikey wrote: > > CSIGNAL is 0xff, so values in the range 65-255 are possible. However, > valid_signal() only accepts signals up to _NSIG (64 on x86_64), causing > a WARN_ON in do_notify_parent() when the process exits: > > WARNING: kernel/signal.c:2174 do_notify_parent+0xc7e/0xd70 Again, do_notify_parent-sanitize-the-valid_signal-checks.patch was dropped. do_notify_parent() won't WARN() in this case. > Note that this is a user-visible change: previously, passing an invalid > exit_signal to clone() was silently accepted. The man page for clone() > does not document any defined behavior for invalid exit_signal values, > so rejecting them with -EINVAL is the correct behavior. It is unlikely > that any sane application relies on passing an invalid exit_signal. Yes, it only documents that if exit_signal == 0 then the parent process is not signaled when the child terminates. But in fact a non-zero non-valid signal acts the same way. > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -2687,6 +2687,8 @@ pid_t kernel_clone(struct kernel_clone_args *args) > (args->pidfd == args->parent_tid)) > return -EINVAL; > > + if (!valid_signal(args->exit_signal)) > + return -EINVAL; OK, but then it also makes sense to remove the same valid_signal() check in copy_clone_args_from_user() ? Oleg.