From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C131C34031 for ; Tue, 18 Feb 2020 22:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3BD4206E2 for ; Tue, 18 Feb 2020 22:26:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dS5irFAO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbgBRW0v (ORCPT ); Tue, 18 Feb 2020 17:26:51 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34336 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726461AbgBRW0v (ORCPT ); Tue, 18 Feb 2020 17:26:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eHa75jjK7tbUuErtO3G7nDpZI0D8u2i7RzDZ3Fa/mSQ=; b=dS5irFAO/VhYF4UgVQoLT0B9O6 MPBORZ5xrN/aS26lKpicm7lsfmaZEgK7qANlYypTZI/HpdFjldeBJ4aM0/EnZAA3dj8Vwu+qQid+r FPq1TmKLYaDObZEBGGMF1Pre4M7hYA2wZnviMARe43CWRTOzm4OD1DK3DFT2hNuqQKcILTTWOrT/p pHACZcmDalugA5C0kKEPIDuKQeTySqkBFM7N/17CrsZOtcfqDWEhfoBTYdi0Rdxb1c/y41yFrpImK LtOG+hBNetGPMvosrbIR3WVLMWVdbz6tkMHUtl3eI/LPdNifpqQGPcHDkKcSQk+jGtYdGOpUi7hvM 4ujvVuSw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4BK3-0003xA-Uu; Tue, 18 Feb 2020 22:26:31 +0000 Date: Tue, 18 Feb 2020 14:26:31 -0800 From: Christoph Hellwig To: Christian Brauner Cc: =?iso-8859-1?Q?St=E9phane?= Graber , "Eric W. Biederman" , Aleksa Sarai , Jann Horn , smbarber@chromium.org, Seth Forshee , Alexander Viro , Alexey Dobriyan , Serge Hallyn , James Morris , Kees Cook , Jonathan Corbet , Phil Estes , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v3 15/25] posix_acl: handle fsid mappings Message-ID: <20200218222631.GB9535@infradead.org> References: <20200218143411.2389182-1-christian.brauner@ubuntu.com> <20200218143411.2389182-16-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218143411.2389182-16-christian.brauner@ubuntu.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: On Tue, Feb 18, 2020 at 03:34:01PM +0100, Christian Brauner wrote: > diff --git a/fs/posix_acl.c b/fs/posix_acl.c > index 249672bf54fe..ed6112c9b804 100644 > --- a/fs/posix_acl.c > +++ b/fs/posix_acl.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > static struct posix_acl **acl_by_type(struct inode *inode, int type) > { > @@ -692,12 +693,12 @@ static void posix_acl_fix_xattr_userns( > for (end = entry + count; entry != end; entry++) { > switch(le16_to_cpu(entry->e_tag)) { > case ACL_USER: > - uid = make_kuid(from, le32_to_cpu(entry->e_id)); > - entry->e_id = cpu_to_le32(from_kuid(to, uid)); > + uid = make_kfsuid(from, le32_to_cpu(entry->e_id)); > + entry->e_id = cpu_to_le32(from_kfsuid(to, uid)); > break; > case ACL_GROUP: > - gid = make_kgid(from, le32_to_cpu(entry->e_id)); > - entry->e_id = cpu_to_le32(from_kgid(to, gid)); > + gid = make_kfsgid(from, le32_to_cpu(entry->e_id)); > + entry->e_id = cpu_to_le32(from_kfsgid(to, gid)); > break; Before we touch this code any more it needs to move to the right place. Poking into ACLs from generic xattr code is a complete layering violation, and all this needs to be moved so that it is called by the actual handlers called from the file systems.