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 0363A20ED for ; Tue, 17 Mar 2026 19:08:22 +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=1773774504; cv=none; b=A8elKDIDEUCrhmBwRGEMaMxraAURsjXFmGs1pwME63iEZ63rUK5kqwb47JZDARdMHFJD6lVH1jdBVb5eh57lYnVvRCe+sXzoTSwe6qZqDA2fFZo1+UkCiNK5vq8LJQCXS2Yxk+FcQV2UyPzokk/bqBEmgnlwIOa1HDKZisSmGUg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773774504; c=relaxed/simple; bh=2SUSDSp/w20KEsHOsB4FZWtUIRh+ChfELCAutzUJfz0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C+MRchpexDxde2pAjvThzzpe+bu41IDQ3G7r80tTJw00rVGdClwO9T52pD3AUMsmPm6j+XSUG6m8vkf0vqxwXg2//d2Rt2G4iK62WxhTJyjxeVSAFmmW5380du6k9FoApnOkaNC7U4WhjDUY+5XOWizB8Vda5eScSpnHNHKcoXo= 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=ZowhB4Yb; 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="ZowhB4Yb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773774502; 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=9cMncruhV3zGKox3/ctrnX7MA7dyJ750pVWwUyV32A0=; b=ZowhB4YbTTdF8rV+ziUMo6dxTMvMA6zLMfBRwp5zpYse0ZejYk3JFV79PLHYBaMYrbJYMh C5uIeBAaqPBQAqLmh2VyznZx61Dola0POd3JThA3bDHL+LaT5zdKdqtYDxGzeXhANgn9ws xo1ps0UIDiDHexdhshVDnrzmjpZXpeQ= 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-183-eCvhrhSaO-murqpA7XqfXg-1; Tue, 17 Mar 2026 15:08:18 -0400 X-MC-Unique: eCvhrhSaO-murqpA7XqfXg-1 X-Mimecast-MFC-AGG-ID: eCvhrhSaO-murqpA7XqfXg_1773774497 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 6E4BC1800245; Tue, 17 Mar 2026 19:08:17 +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 9EEEC30001A1; Tue, 17 Mar 2026 19:08:15 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 17 Mar 2026 20:08:17 +0100 (CET) Date: Tue, 17 Mar 2026 20:08:14 +0100 From: Oleg Nesterov To: Andrew Morton Cc: Deepanshu Kartikey , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH -mm v2] do_notify_parent: sanitize the valid_signal() checks Message-ID: References: <20260316151956.563558-1-kartikey406@gmail.com> <20260317113452.cede9a514dfed36a1cb0e5a9@linux-foundation.org> 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: <20260317113452.cede9a514dfed36a1cb0e5a9@linux-foundation.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 03/17, Andrew Morton wrote: > > On Tue, 17 Mar 2026 14:58:18 +0100 Oleg Nesterov wrote: > > > Now that kernel_clone() checks valid_signal(args->exit_signal), the "sig" > > argument of do_notify_parent() must always be valid or we have a bug. > > > > However, do_notify_parent() only checks that sig != -1 at the start, then > > it does another valid_signal() check before __send_signal_locked(). > > > > This is confusing. Change do_notify_parent() to WARN and return early if > > valid_signal(sig) is false. > > Sashiko has a question: > https://sashiko.dev/#/patchset/abld-ilvMEZ7VgMw%40redhat.com I think that userpace can't bypass kernel_clone() (which checks valid_signal) before copy_process(). This includes ia32_clone() and sparc_clone() mentioned in the link above. There are in-kernel users (fork_idle, create_io_thread, vhost_task_create). But if they pass a non-valid exit_signal (they don't), we do have a kernel bug and WARN_ON() added by this patch should catch the problem. In short. From the link above: While kernel_clone() expects the caller to validate args->exit_signal this was true before kernel-fork-validate-exit_signal-in-kernel_clone.patch from Deepanshu, and my cleanup depends on it. Oleg.