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 26085485517 for ; Thu, 6 Aug 2026 17:18:39 +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=1786036721; cv=none; b=tWRsXDTv7GHmWpCtjYxMk5xY51z5+4negirEzPSsOnqUnFX5d/tCZydZzO5BpIShQ0tRMIWBBwS2bfOlS7bdWjWdUEDU9b2YAYiDtBj0u6AHZESlCJ2agBO7qydHKAlMFoCeSQJIipRK59HOgeeACQzTBC3M1atSXrsY1fDcEOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786036721; c=relaxed/simple; bh=+UbXJCFktOBlqLi3L2rn3chz2x1IVvNA375ufjEF0jU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K1+24Uu2p6qGXsKiyKI09WXWYaIk/4w8Tvu8I4en79HdvgQJxmjG0nFu7iCsT4Bv/6fYvTzQAe2a6TrrMDmk8ihJGieMpf0/cOQtZCQWlO3RvjpCEMUf68oCDuQLYULbKYu8aLERUv6ABqs3fa7e922PQWEbu5Amar2FJY3ymQY= 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=V08logaM; 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="V08logaM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786036719; 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=SXvzaTgUM1u7UpWcVlK8PxtbiTEOg11+vyEcL97kCik=; b=V08logaMOGCkZFndkCjwNuiNo1Wh415EShc5ngnHbeQxedery7pUboBF4+0iLvLna7GDpl Ond+g60YPsgNi+XYAwIAEEbQVSto/Q2iFkz0PgLsaB0v9g/WsNdxw1HSnPM5n5/wmhfQHm zYwJ0f3efmS9LPJbvV8exsR8Ocu93mY= 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-613-XY54cIrBM9e_G1e4fBrPRg-1; Thu, 06 Aug 2026 13:18:36 -0400 X-MC-Unique: XY54cIrBM9e_G1e4fBrPRg-1 X-Mimecast-MFC-AGG-ID: XY54cIrBM9e_G1e4fBrPRg_1786036715 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 D35601800876; Thu, 6 Aug 2026 17:18:34 +0000 (UTC) Received: from fedora (unknown [10.44.32.54]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id F29D23000239; Thu, 6 Aug 2026 17:18:32 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 6 Aug 2026 19:18:34 +0200 (CEST) Date: Thu, 6 Aug 2026 19:18:31 +0200 From: Oleg Nesterov To: Bradley Morgan Cc: Andrew Morton , Christian Brauner , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] signal: factor out the kernel reserved si_code check Message-ID: References: <20260806133013.4341-1-include@grrlz.net> 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: <20260806133013.4341-1-include@grrlz.net> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 08/06, Bradley Morgan wrote: > > The check that prevents userspace from sending siginfo with si_code > values reserved to the kernel is duplicated across do_rt_sigqueueinfo(), > do_rt_tgsigqueueinfo() and do_pidfd_send_signal(). Move the check > into a helper so the rule lives in one place. > +/* > + * Not even root can pretend to send SI_FROMKERNEL() signals. > + * Nor can they impersonate kill()/tgkill(), which have si_pid/uid > + */ > +static bool si_code_reserved_to_kernel(int si_code) > +{ > + return si_code >= 0 || si_code == SI_TKILL; > +} OK, Acked-by: Oleg Nesterov But can't resist... We already have SI_FROMUSER() and SI_FROMKERNEL() both take the pointer to siginfo as an argument. Now we also have si_code_reserved_to_kernel() which falls into the same category, but it aceepts .si_code and the names don't match... OK, nevermind. I can't suggest a better name. Even if we change the new helper to take "kernel_siginfo_t *info" to match SI_FROMXXX macros. Oleg.