Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2079095ybv; Fri, 14 Feb 2020 11:03:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxhDkehnaKwi8DUMOX/Ntxr1JkuWaqW55w4MK2uQtbWKE3boRNcwl+jCtJzWF2rUhoMaNYr X-Received: by 2002:aca:f587:: with SMTP id t129mr2784701oih.143.1581707020469; Fri, 14 Feb 2020 11:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581707020; cv=none; d=google.com; s=arc-20160816; b=Sw+OodAzEszsufuECSPgolFFkN28DsyKhV4HARC4Z645xbaPaSHsSQ5dctSYxt1ehP B9VSkO6imYOe5glkknqNxGTEmZD5TA8YBgGAiPfs5C73a1BZmo/87QA2uFCWdMfoc5pI I27PtWH1c+7pkG7RcixELRBLAt4YkFSHI01CDSfIY1JdPgWjNHB+5RvyVmuHBmS/p5Xk rzuRRUBLotPVpDpjPwm1QFCXOyLh7cpLOBJ0CL0XbQ8nG1mUKsxn58E1iH9LRN6lsaQ2 492bxllEppsiroJYnob+6OFa5R6xlNFaHB6+2OC62Xczk4CyIgqMkkscKc+m8IF3/e+G roeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=X67Mr7JHgMW0MtPbY5RUDBc6idW8KEYPReWaSuRnXh4=; b=DbWykJWc5ZmhAthamyDwi+5MO8OET1kcdPN8ezIbaI49uMMWLjfiwTIB9u1KvmhSIR 1DXnhBeOgaVfQEDVFfLq8x7ZC5fFpi9Y4pD12MhFyy5bmgfqkmdssXOUbNDCicanlvv6 bPRIjWA2rFM7cg+u9aHfzaO9QXyIUgctpBMfjYKNCGU8ujVMmzslD8CaQ2MVa8fhUAHs v0O1l9S30DPzlFatg+tt5Tn3I4jz4uFuQJ7Y5NFw/5y6AlitLOTop9tnhQo72donRrYQ 8JtkHRlIUeuAcMhvVcuFWBgRsKEN0w61RyDGbxryJSiwWMdG3IS3I26sGKFZBUvKDmRF CVDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=v0JLbJHa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q66si3056530oig.65.2020.02.14.11.03.27; Fri, 14 Feb 2020 11:03:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=v0JLbJHa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729617AbgBNTDU (ORCPT + 99 others); Fri, 14 Feb 2020 14:03:20 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:38348 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729479AbgBNTDU (ORCPT ); Fri, 14 Feb 2020 14:03:20 -0500 Received: by mail-pj1-f66.google.com with SMTP id j17so4300374pjz.3 for ; Fri, 14 Feb 2020 11:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X67Mr7JHgMW0MtPbY5RUDBc6idW8KEYPReWaSuRnXh4=; b=v0JLbJHanSqJgxnGB542gdGMsejEY6woNkilQ94b+P9gJ+YAMQgsu9ur6JPedZ9A3Y F2taOjVCszau/FtGTE4KIYWb00umSwqDTMoeIGGck0H4ZjPOUWqry7S8K5Fh6x28E6iF SmB56gTFYXn3LYMGEXqJsCBWipK43wSQa3ZDgo9lFxdMW4DVx4MCAFdqH4uMq98UCSIy c/9MmVX/DzPYfTZvGTwAJ5SMGNPcSMRjI7NG0ecOjiyy9p2kZXVm4ZJcMAnPZQlkGSPK XMzeJo/tveLYVOhGY1FueG8X0zp7bDjMGTcFGvf/espDzfHyJ5pmJJVFdkWZzoJOr9qB 0RLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X67Mr7JHgMW0MtPbY5RUDBc6idW8KEYPReWaSuRnXh4=; b=EijBEN0NTksSE8yor9xvoOSvRPh+zOMXTPR+0HFj4FNCwbm08qWXsuI3cjNExj1hYy vS6vsub/y+fVFuWVhNdBJgqmJQtr9Mw9V9lAYQVWL0zwh6A01A+JwtJp5Ec2coZU1BYf hlajJ2nKuggEx7n+RSUZujF239MPq1eytIwbZMMaj98+AK+o2aDgRnEJYmsY67+3Eypb JD2Pm6lsMgaGVawxmWDU/oJj/ilSKSILmcRwCEMJvmqF2Nc97/JtvDXFWDKQs+SFFb7K OgPxD1Km7oyZr1tNpwqGDuj7Jtc05jX9jog4MUtlG8PZ2qXhzhjhwTsU7fu5sYCYeWbt lw2A== X-Gm-Message-State: APjAAAUJM4wDQ/ADz1ZfZhKLJdf1S06iGkRDNE5yyrqAhY5AAM8h1X1X 4je61rhJlK2QzNvmzrOSLGg/yw== X-Received: by 2002:a17:90a:fe02:: with SMTP id ck2mr5267083pjb.10.1581706997875; Fri, 14 Feb 2020 11:03:17 -0800 (PST) Received: from cisco ([2001:420:c0c8:1005::22c]) by smtp.gmail.com with ESMTPSA id r6sm7877667pfh.91.2020.02.14.11.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 11:03:17 -0800 (PST) Date: Fri, 14 Feb 2020 12:03:14 -0700 From: Tycho Andersen To: Christian Brauner Cc: =?iso-8859-1?Q?St=E9phane?= Graber , "Eric W. Biederman" , Aleksa Sarai , Jann Horn , Kees Cook , Jonathan Corbet , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, smbarber@chromium.org, Seth Forshee , linux-security-module@vger.kernel.org, Alexander Viro , linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan Subject: Re: [PATCH v2 19/28] stat: handle fsid mappings Message-ID: <20200214190314.GD22883@cisco> References: <20200214183554.1133805-1-christian.brauner@ubuntu.com> <20200214183554.1133805-20-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200214183554.1133805-20-christian.brauner@ubuntu.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 14, 2020 at 07:35:45PM +0100, Christian Brauner wrote: > @@ -471,8 +484,13 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) > #endif > tmp.st_mode = stat->mode; > tmp.st_nlink = stat->nlink; > - tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid); > - tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid); > + if (stat->userns_visible) { > + tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid); > + tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid); > + } else { > + tmp.st_uid, from_kfsuid_munged(current_user_ns(), stat->uid); > + tmp.st_gid, from_kfsgid_munged(current_user_ns(), stat->gid); > + } I suppose this should be = ? Tycho