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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 1B8D8C35DEE for ; Thu, 27 Feb 2020 16:52:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7B84246A1 for ; Thu, 27 Feb 2020 16:52:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="h2ckek+4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730538AbgB0QwV (ORCPT ); Thu, 27 Feb 2020 11:52:21 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:44727 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730543AbgB0QwS (ORCPT ); Thu, 27 Feb 2020 11:52:18 -0500 Received: by mail-oi1-f196.google.com with SMTP id d62so3930126oia.11 for ; Thu, 27 Feb 2020 08:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gp52pRjsJhSA+Hsa491NiMGo7ZzN8vh48sP/xPZjY7A=; b=h2ckek+46BKub8OVUhke3FC/nXyQRCv+YQ5y9CV5RbavgOyX2emB9a6/jb7odtCAKM 5ltcv6eQIF7Ic86LAqy26c5McXL14zfj7SHokiEMytQXVSGvnJlTtIuSNHkSOQkFWjRP Mu7gYWpvSfwVaBUOsaWiRTp0YvOLWDionRgvz1JkZwXSBMY3V3b96qCMcMlj0mUxU56T mo9uGvza0log5cdDTTy2ztxkZVwF2Oog57jDbqdSKdT3X6QIagU/KCEypSCKV9XaPvzj wCtt3eoq7JH1jvdYAAnC4fMTn7+3EHxTnrbfi6sRJvcEaM84OCdYDwSLRgwprggtt3Y2 wEKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gp52pRjsJhSA+Hsa491NiMGo7ZzN8vh48sP/xPZjY7A=; b=JLpUZKw8hweYmHCSLF8QixLtMpQ4vJP1s2yrr5plKSn4spgol7HRQChbNgAEwxz5AE MMuQOJrt+CXMglJTovr012Bnu/Xs77HQGm0TzTXRaXZajpwTV1qv06cnS2hFhJiqsXqu J0U+nDnC5T+J4+VBYAXEx966o6B7P3uaQp9+YEZwoNljK4Lo480p8usZ+5ej8+lDA45z FWPPc/qRUmyoeWN0UUIuHMaqbI0G2m0IBaSj/On2uPJdjjzBGgLfBuOZgPqQP5eS7r4m zdiyWfDdGx4jeIAkCmKZXP5UvbkeDI0wqBK+tQh9zuVzVL50LgbFa/dcsyQnfm0CLvjn Gxxg== X-Gm-Message-State: APjAAAURkXyQ33uwKU2fiVJXvhzs3xc7j6c7M2LHyu3pnm+AzxdLV6Io vnx7h326oJau3IUvdO8UI40m6ydB2v/KyY02NDa+aQ== X-Google-Smtp-Source: APXvYqwtYAjsjMZBmazOMBlU4tgSOoeRD3FzHInhjMiQQq9Hs9Q8FYDFJIJz944uJE8l8reZMl0eKMk+IJoxnZLWgp0= X-Received: by 2002:aca:d954:: with SMTP id q81mr4104431oig.157.1582822337290; Thu, 27 Feb 2020 08:52:17 -0800 (PST) MIME-Version: 1.0 References: <20200224160215.4136-1-mic@digikod.net> <20200224160215.4136-6-mic@digikod.net> <34319b76-44bd-8915-fd7c-5147f901615e@digikod.net> In-Reply-To: <34319b76-44bd-8915-fd7c-5147f901615e@digikod.net> From: Jann Horn Date: Thu, 27 Feb 2020 17:51:51 +0100 Message-ID: Subject: Re: [RFC PATCH v14 05/10] fs,landlock: Support filesystem access-control To: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= Cc: kernel list , Al Viro , Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Greg Kroah-Hartman , James Morris , Jann Horn , Jonathan Corbet , Kees Cook , Michael Kerrisk , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , "Serge E . Hallyn" , Shuah Khan , Vincent Dagonneau , Kernel Hardening , Linux API , linux-arch , linux-doc@vger.kernel.org, linux-fsdevel , "open list:KERNEL SELFTEST FRAMEWORK" , linux-security-module , "the arch/x86 maintainers" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: On Thu, Feb 27, 2020 at 5:50 PM Micka=C3=ABl Sala=C3=BCn = wrote: > On 26/02/2020 21:29, Jann Horn wrote: > > On Mon, Feb 24, 2020 at 5:03 PM Micka=C3=ABl Sala=C3=BCn wrote: > >> +static inline u32 get_mem_access(unsigned long prot, bool private) > >> +{ > >> + u32 access =3D LANDLOCK_ACCESS_FS_MAP; > >> + > >> + /* Private mapping do not write to files. */ > >> + if (!private && (prot & PROT_WRITE)) > >> + access |=3D LANDLOCK_ACCESS_FS_WRITE; > >> + if (prot & PROT_READ) > >> + access |=3D LANDLOCK_ACCESS_FS_READ; > >> + if (prot & PROT_EXEC) > >> + access |=3D LANDLOCK_ACCESS_FS_EXECUTE; > >> + return access; > >> +} [...] > However, I'm not sure this hook is useful for now. Indeed, the process > still need to have a file descriptor open with the right accesses. Yeah, agreed.