Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3804283ybv; Sun, 16 Feb 2020 06:14:43 -0800 (PST) X-Google-Smtp-Source: APXvYqx/O3xaDmaxKawa9lo2D+Art1zVRvb+jgFGIgc36IhmQtHWXCEawf7NW7INSDr20gHP6+yC X-Received: by 2002:aca:b60a:: with SMTP id g10mr7096367oif.102.1581862483465; Sun, 16 Feb 2020 06:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581862483; cv=none; d=google.com; s=arc-20160816; b=eEShP9IeKSL0lwCbVt/j0hJuWM178+Ga5AhmE+rJMBeqZzxw0EQlGX9S4TLKZzm5p+ qZYYxpZOFm0UEn7hm1PM2S8wY0d0+bQs3XCUBmjB5VaP94xooxx/G0qz6Ezky7Xnbg0w tKmJmdrNggDAkX9rCYRjln6Ziwar1Ti1p0lXNKTAoQxNi2/IPSVLmxyLmekrARqbdmal dCC1vvJLfjWK54QFGu1Ac9q8NIXAauZwDFU0WFYWZs9W30xFTMk2WvYMw2SnkDJ5hkAR ZcjFdcFRYJhxYgpyrtefQFlPB1hbyAQFQThldVlRIUQKsDEdX8eOPDQYStDFRGB9Np94 UwoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=erZ/nsL43vqisjELWj0M8UzXDpAGlK6Mo0ah1D44+XI=; b=Tf2GNTUh8M66v8an8mAl3DObUwqG2zNXX7cv/amBJSrtS2jtVu79q3wLl0cJ8C14AV CCA/o0nHEZYjuHajHwkdNNCkaa3cEFP0ntsWBeHDAQ8Jiz08+WCzLYLnPnhGD+6UPJH1 YJ2c8Ik+QsEm+X6wIeisdZS61S2k5qUCw7MXazEA+hQ+Rl51s3QHvf0UujGvR+FwLnRE doxuN77K6wUvcqS4ixaYMvjdeACgjVYAufY/8dpUppoQ0ATKvoBrrgh5Uj+K+MCUa93g tWTBc2v1G31jBCGYoRI0uIHWP19C/TI5OH2oQtBiWLI0QktqALr3vDr/HdDpMv7TawDR J8gA== ARC-Authentication-Results: i=1; mx.google.com; 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 m82si5469106oig.129.2020.02.16.06.14.31; Sun, 16 Feb 2020 06:14:43 -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; 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 S1728308AbgBPOMm (ORCPT + 99 others); Sun, 16 Feb 2020 09:12:42 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:46336 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgBPOMl (ORCPT ); Sun, 16 Feb 2020 09:12:41 -0500 Received: from ip5f5bf7ec.dynamic.kabel-deutschland.de ([95.91.247.236] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j3Kf0-0000yC-JA; Sun, 16 Feb 2020 14:12:38 +0000 Date: Sun, 16 Feb 2020 15:12:37 +0100 From: Christian Brauner To: Tycho Andersen Cc: linux-security-module@vger.kernel.org, Kees Cook , Jonathan Corbet , Alexey Dobriyan , linux-api@vger.kernel.org, containers@lists.linux-foundation.org, Jann Horn , linux-kernel@vger.kernel.org, smbarber@chromium.org, Seth Forshee , "Eric W. Biederman" , linux-fsdevel@vger.kernel.org, Alexander Viro Subject: Re: [PATCH v2 19/28] stat: handle fsid mappings Message-ID: <20200216141237.nk7yh7hdwpo5nmfx@wittgenstein> References: <20200214183554.1133805-1-christian.brauner@ubuntu.com> <20200214183554.1133805-20-christian.brauner@ubuntu.com> <20200214190314.GD22883@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200214190314.GD22883@cisco> 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 12:03:14PM -0700, Tycho Andersen wrote: > 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 = ? Good catch. I thought I had eliminated all those by doing automated conversion but apparently not. :) Christian