Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2386138pxb; Sun, 15 Nov 2020 02:52:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7zxcmwBJWRfH4zvHlsu3EWHhdoanypaZ8Fm+tMwa+OAJRRH5XTFVA7OQTTbE1dGklYy4c X-Received: by 2002:aa7:c358:: with SMTP id j24mr11017838edr.265.1605437549401; Sun, 15 Nov 2020 02:52:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605437549; cv=none; d=google.com; s=arc-20160816; b=YFbFPwsJZ48wNCTfF/lAqEdbMIM6jslSFGeowSUHSLZUehddSo0/o3f5+p7Ze8mtaG mqQK3wRLD/prxRVBUDeLe8PNlgsWgrSMr1vrhIfwN4tOx91N2QPp0msbdl4FSC3Z7zLj qzlNAi8l3qoS2hGTu18q10F9iWEufrjvv79Ds37G58pjcgpBO9FMTN22QU6jRojqGb3M dovMCAL/l17MAfSLNmkZTkMyZ5Ox982E4wgdXMS0BpHoHsX43tHU9f/nGi6xL9D9jlKl d/G4YaRoOxj5SwVRFL3jJXQKC+6gjL/DOeMMZ9ZHzM0psr6G7GCy/t6D+IeUyZjmfZjo mlpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zwRUayNFRlS02rKNIuW8iIhJYntu7WTby/ZwSfZp4CM=; b=y9PJ7szYk0TsAzVzaQUB/uJuvI7s/G+5A63PsogtE4+H6Y8E9+q1nusKbLiT9skQFd T3BHIdEW+g0yYTkgqeNmMM7bzKjcACDMUVQPY4AmQ/0vzrMFL9YfwxSJosnTlAR2lpFU m+Wngg7JTFPn5HUX7HmMOqQekM9e+G7oOMHNz89lQjf4lm026DcPpZYdN2twVzsBdHHl B4XUtCu30WclhXeRoi2mMv05lqODsCWdCUztcjLGeND86UQKRnIF4h0XMau1t5mzvucR PPZQN46f2MRHpgedXtJFTEIvkYGMz1JJh57ieuRhpuUmDstquKXNCuRS1/lyQ94Eqyyt fPxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si10177169edk.97.2020.11.15.02.52.06; Sun, 15 Nov 2020 02:52:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbgKOKuU (ORCPT + 99 others); Sun, 15 Nov 2020 05:50:20 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60092 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726938AbgKOKuT (ORCPT ); Sun, 15 Nov 2020 05:50:19 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1keFRF-0000Kt-Ej; Sun, 15 Nov 2020 10:39:17 +0000 From: Christian Brauner To: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org Cc: John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Jann Horn , Seth Forshee , =?UTF-8?q?St=C3=A9phane=20Graber?= , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Jonathan Corbet , containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-audit@redhat.com, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, Christian Brauner , Christoph Hellwig Subject: [PATCH v2 21/39] af_unix: handle idmapped mounts Date: Sun, 15 Nov 2020 11:37:00 +0100 Message-Id: <20201115103718.298186-22-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115103718.298186-1-christian.brauner@ubuntu.com> References: <20201115103718.298186-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When binding a non-abstract AF_UNIX socket it will gain a representation in the filesystem. Enable the socket infrastructure to handle idmapped mounts by passing down the user namespace of the mount the socket will be created from. Non-idmapped mounts will not see any altered behavior. Cc: Christoph Hellwig Cc: David Howells Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner --- /* v2 */ unchanged --- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b4987805e5e5..4be33240e9cc 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -996,7 +996,7 @@ static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) */ err = security_path_mknod(&path, dentry, mode, 0); if (!err) { - err = vfs_mknod(&init_user_ns, d_inode(path.dentry), dentry, mode, 0); + err = vfs_mknod(mnt_user_ns(path.mnt), d_inode(path.dentry), dentry, mode, 0); if (!err) { res->mnt = mntget(path.mnt); res->dentry = dget(dentry); -- 2.29.2