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 DC28A3E123E for ; Mon, 20 Jul 2026 11:57:51 +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=1784548675; cv=none; b=mGNNNL0Qir/8111frxuo8D81ytmafz9BcxS8GayMXcLrud3YLPPAcwqwdxubgsSNZSZJX1eAMqleR8xmYMNOUJ53VL5W3vvddlga6Q1WfCbaTlEvvKngdBpX7XZ9BeUQvvNq4RFFMO+wWv2XByaIbAfNppJIlOmVLKaaMCCOYLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784548675; c=relaxed/simple; bh=KSKVfSQcKkD0Ov+VY8YwW6DjNnb12D/MLaMt5tira9w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IgtEE8IW731535GkS1D71AHXIUWaKhVV124h3V4/gjKh0x+4Wj0M2gvbVnclJUM0t6ROLfdmEEbqlhlTF2ynCiGbCVB9kieb7UzSK5ZeemVigP+LVqYSukJLI9DqJSZFIzifNzagT98DWJe4xwlPkTQKEZmxMNnl/B8El5sG0nc= 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=h1ObqOmV; 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="h1ObqOmV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784548670; 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=KSKVfSQcKkD0Ov+VY8YwW6DjNnb12D/MLaMt5tira9w=; b=h1ObqOmVHg3WSprRcPCFMYbyKSvi0fwGKphSRJ1LZ1+sud2yNrMZGVbIU63OLVMEBAyRK7 WEjC9Y1FQoWjgSxk8Hpg59IJ/M1RKBr8sY2rXMVkbgJHF8Q8zbQFFel3seuMzQLsx2FhBA Yh58JF1r9/Gf+R1GeS305LhFWMLuJfk= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-55-suVHrH4dMSmjdKwq9nOuAQ-1; Mon, 20 Jul 2026 07:57:46 -0400 X-MC-Unique: suVHrH4dMSmjdKwq9nOuAQ-1 X-Mimecast-MFC-AGG-ID: suVHrH4dMSmjdKwq9nOuAQ_1784548665 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6EFD7195C243; Mon, 20 Jul 2026 11:57:44 +0000 (UTC) Received: from fedora (unknown [10.44.49.164]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 4C3E7158C; Mon, 20 Jul 2026 11:57:40 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 20 Jul 2026 13:57:44 +0200 (CEST) Date: Mon, 20 Jul 2026 13:57:39 +0200 From: Oleg Nesterov To: Bradley Morgan Cc: Andrew Morton , Alexey Gladkov , "Cen Zhang (Microsoft)" , Christian Brauner , "Eric W. Biederman" , Mateusz Guzik , Pavel Tikhomirov , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sysctl: move the "cad_pid" entry from pid_table[] to kern_reboot_table[] Message-ID: References: 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: X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 On 07/20, Bradley Morgan wrote: > > On July 20, 2026 12:13:43 PM GMT+01:00, Oleg Nesterov > wrote: > >cad_pid is global, and kill_cad_pid() is only used in the root namespace. > > > >However, due to pid_table_root_permissions(), a non-root user can unshare > >pid/user namespaces and modify it from the child namespace. This makes no > >sense and is simply wrong. > > > >Move it to kern_reboot_table[] where it logically belongs; this ensures > >that only GLOBAL_ROOT_UID can read/modify this sysctl. > > > >Note that this patch doesn't preserve "#ifdef CONFIG_PROC_SYSCTL" around > >the "cad_pid"; CONFIG_PROC_SYSCTL selects CONFIG_SYSCTL, so it is always > >set when kern_reboot_table[] is compiled. > > Worlds smallest nit: Could you add the patch this was inspired by in the > description? > > E.g: > > This patch was inspired from Cens patch fixing a UAF in cid_pid [1] This patch was inspired by sashiko.dev who found this problem. Not by the patches from Cen. I'd be happy to add Reported-by: sashiko.dev but I don't think I can. Oleg.