From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) (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 6D1931C4A20 for ; Mon, 2 Mar 2026 19:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.70.13.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772479468; cv=none; b=BseqC6rnLjexedY5uidFX1XAAVqa63v46uWmMKI73mvOFNeFI1yvhyTipmPSw4U9PpPNEC9ddprNxaPE+RAoL2jquHTftB34bs8pM2kR19OpHYWq+wPMOiZCUPGDdiA5Rs8VYZiSXRyOZA3RGRoGMSgRGchIcxECkKFErzigxz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772479468; c=relaxed/simple; bh=oXyBVayeIXlRc2n4DELZZEK9AuZL86MAOCWGruzjxg4=; h=From:To:Cc:Cc:In-Reply-To:References:Date:Message-ID:MIME-Version: Content-Type:Subject; b=LyeFJHPn9Z3uQXdAn5xD3T2HR49d8KW5SrI4H21XnObU4f+1DtZedjdq63GFf9xOvJ2MQhD7utz+RZlnbj9gBdJs2lD2746tf8cRZ9ZIuc7yD7l1GI68ZDyx4uTu/rclTy2wcZ2+wse49qhu7XBCaMznO2e6wMHcdcH8J48Xulg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com; spf=pass smtp.mailfrom=xmission.com; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b=Wx35bqIl; arc=none smtp.client-ip=166.70.13.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xmission.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b="Wx35bqIl" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=xmission.com; s=xmission; h=Subject:Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oXyBVayeIXlRc2n4DELZZEK9AuZL86MAOCWGruzjxg4=; b=Wx35bqIlkNO4sGrXG9I76vuPBe ka5DxwnU/TQ3U5Ws9HYtVbPi0GWBOEF1Tz+MB3pFQoA4PLCltaaUTpt/8tceJwtdpZkHvshnsY6zn SgduhKyf020IIS0BsVpwsdQfwvUPOfk+9Nzy5QDrsOAzbrVBdyE8EXw7REhtTztMwsko=; Received: from in02.mta.xmission.com ([166.70.13.52]:46088) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1vx7t4-00HJ2N-Vt; Mon, 02 Mar 2026 11:20:59 -0700 Received: from ip72-198-198-28.om.om.cox.net ([72.198.198.28]:54018 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1vx7t3-004bH2-9x; Mon, 02 Mar 2026 11:20:58 -0700 From: "Eric W. Biederman" To: Pengpeng Hou Cc: linux-kernel@vger.kernel.org, 18291782795@163.com Cc: Andrew Morton In-Reply-To: <20260302085051.4128542-1-pengpeng.hou@isrc.iscas.ac.cn> (Pengpeng Hou's message of "Mon, 2 Mar 2026 08:50:51 +0000") References: <20260302085051.4128542-1-pengpeng.hou@isrc.iscas.ac.cn> Date: Mon, 02 Mar 2026 12:20:54 -0600 Message-ID: <874imyozy1.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1vx7t3-004bH2-9x;;;mid=<874imyozy1.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=72.198.198.28;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX1/21+iqfOOX+XJEfR0Kbb2sYfqdqb5JKw4= X-Spam-Level: X-Spam-Virus: No X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.1 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4998] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 XM_B_SpammyTLD Contains uncommon/spammy TLD * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Pengpeng Hou X-Spam-Relay-Country: X-Spam-Timing: total 1124 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.9 (0.3%), b_tie_ro: 1.97 (0.2%), parse: 0.65 (0.1%), extract_message_metadata: 9 (0.8%), get_uri_detail_list: 0.87 (0.1%), tests_pri_-2000: 5 (0.5%), tests_pri_-1000: 1.87 (0.2%), tests_pri_-950: 1.03 (0.1%), tests_pri_-900: 0.80 (0.1%), tests_pri_-90: 108 (9.6%), check_bayes: 106 (9.4%), b_tokenize: 4.3 (0.4%), b_tok_get_all: 4.8 (0.4%), b_comp_prob: 1.28 (0.1%), b_tok_touch_all: 93 (8.2%), b_finish: 0.80 (0.1%), tests_pri_0: 213 (18.9%), check_dkim_signature: 0.38 (0.0%), check_dkim_adsp: 2.6 (0.2%), poll_dns_idle: 770 (68.6%), tests_pri_10: 1.63 (0.1%), tests_pri_500: 777 (69.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] pid_namespace: Add stub for to_pid_ns() when CONFIG_PID_NS is disabled X-SA-Exim-Connect-IP: 166.70.13.52 X-SA-Exim-Rcpt-To: akpm@linux-foundation.org, 18291782795@163.com, linux-kernel@vger.kernel.org, pengpeng.hou@isrc.iscas.ac.cn X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on out01.mta.xmission.com); SAEximRunCond expanded to false Pengpeng Hou writes: > Currently, to_pid_ns() is only defined when CONFIG_PID_NS is enabled. This > leads to compilation errors in subsystems that attempt to retrieve a PID > namespace from an ns_common structure in a non-namespace-aware kernel > configuration. > > This patch adds a static inline stub for to_pid_ns() in the #else block, > returning the address of the global init_pid_ns. This ensures consistent > API availability and fixes potential build failures. What code in the kernel tree has this problem? Most places in the kernel (notably drivers) it is an error (of the abstraction violation kind) to be playing with pids or namespaces. What code in the kernel tree needs this fix? This change also removes whitespace between functions in the header, and it is desirable to have that whitespace. Eric > Signed-off-by: Pengpeng Hou > --- > include/linux/pid_namespace.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h > index b20baaa7e..ca6032db8 100644 > --- a/include/linux/pid_namespace.h > +++ b/include/linux/pid_namespace.h > @@ -103,7 +103,10 @@ static inline int pidns_memfd_noexec_scope(struct pid_namespace *ns) > { > return 0; > } > - > +static inline struct pid_namespace *to_pid_ns(struct ns_common *ns) > +{ > + return &init_pid_ns; > +} > static inline struct pid_namespace *copy_pid_ns(u64 flags, > struct user_namespace *user_ns, struct pid_namespace *ns) > {