Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp920291pxb; Wed, 6 Apr 2022 04:19:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLlgw6gA8OP1M7uiXyaqt++3/Hmy0jB5q4YzlV+zCZpZd1hiH1Pi7lVoAgGGKekB8LW+ki X-Received: by 2002:a17:90a:f40b:b0:1ca:9d42:cb72 with SMTP id ch11-20020a17090af40b00b001ca9d42cb72mr9043636pjb.187.1649243941930; Wed, 06 Apr 2022 04:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649243941; cv=none; d=google.com; s=arc-20160816; b=GHCsMU3uj3z5mJ/iGW64bbDFXqO0eDbaNCVM7WAmihCb43dmk0MZWdb8Hg0BFVB2Yq eCeT6XSIYYO/DPWujo4Ib7VSuh4c2+reyVHO3gW1y/j/DpfF99Jz9zbrV2d7v3kOGJYj ycUc0K4SE8U9d7zsXEV7DPPzqLFBDyZpf1rsdSnxd5l4XkqhXgthKVdiJnSDjljr27dG +oOAPlu+u+WtdiEzY4qjvQgf3WTSSQyybDwHKVPH6UBoY3kAhyUnxoAGVQpjRNGd3HHA CCwYWEdjaCdT0Fr5cvZFp6X13c6mStj1pk3UuzUaUIMd9XWmzWVuQVRv5m5NDUJMNHcj HVag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=pHyCOuEolvRkKF4zGSJQQdvQQUfuvlyg+uxu66mva/k=; b=C5XjzA/5OHODtITv7eRntkQHwYb/nM1S1d0QvRlLv4hGszGksNM2yOIQgg708egOav O/+iaiQB7GcAFgYncH5SHGk6zMbJzZ95rM6sJLnawhYvJ7G1zwr6ktggv+FrPMhUQYNn jpkMRH6AoHM9IIq7VeNSjxVLaho+P5COfbnKUO/cLTdrvJGhEK+OqNPUm2He64kKiWms sK5hpiEcGI84N2oM+ZfNazI13iTp6LHDX8eztnxQ97PNlbPIzK+pcIuwtj+MwkTgJC9N L/wGVrIXFr781my7vdJbTv7qC0A99VXkZri0CZKc/brPwbNGjHdVZ75k4QwLsVlcUoh1 yCUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gmHoadq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k17-20020a635a51000000b003827526f8bbsi15856308pgm.526.2022.04.06.04.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gmHoadq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66D395E40ED; Wed, 6 Apr 2022 02:41:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358128AbiDEUEA (ORCPT + 99 others); Tue, 5 Apr 2022 16:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457337AbiDEQDG (ORCPT ); Tue, 5 Apr 2022 12:03:06 -0400 Received: from smtp-42ac.mail.infomaniak.ch (smtp-42ac.mail.infomaniak.ch [84.16.66.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 519C121818 for ; Tue, 5 Apr 2022 08:38:21 -0700 (PDT) Received: from smtp-2-0000.mail.infomaniak.ch (unknown [10.5.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4KXsHG6sFqzMpxx0; Tue, 5 Apr 2022 17:38:18 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-2-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4KXsHB10mbzlhNts; Tue, 5 Apr 2022 17:38:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1649173098; bh=CsXI63Mo7UO6r/uWwmX4gFbUZp/CXy5CRXKt0P6gt6c=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=gmHoadq5c/jpwjvzRlDxdSe/QMSdIkQfuWdwnlle2JMgrxICKuYw2Otz5agkacD7Z B3oSAGjmLbhr+bMhGpyxWhZRNmQP4WVnKkPPMB7gr9oFepQ8SCfZOo8micekUP/VgR nsB09g6YQOZdXoGywDPjQHeZ/pGkYe4CO0FU08J8= Message-ID: <1eeae491-7f4f-2cbc-7dbb-04e926c78b89@digikod.net> Date: Tue, 5 Apr 2022 17:38:39 +0200 MIME-Version: 1.0 User-Agent: Content-Language: en-US To: Linus Torvalds Cc: Kees Cook , Al Viro , Andrew Morton , Christian Heimes , Geert Uytterhoeven , James Morris , Luis Chamberlain , Mimi Zohar , Muhammad Usama Anjum , Paul Moore , =?UTF-8?Q?Philippe_Tr=c3=a9buchet?= , Shuah Khan , Steve Dower , Thibaut Sautereau , Vincent Strubel , linux-fsdevel , linux-integrity , Linux Kernel Mailing List , LSM List , Christian Brauner References: <20220321161557.495388-1-mic@digikod.net> <202204041130.F649632@keescook> <816667d8-2a6c-6334-94a4-6127699d4144@digikod.net> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Subject: Re: [GIT PULL] Add trusted_for(2) (was O_MAYEXEC) In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/04/2022 23:28, Linus Torvalds wrote: > On Mon, Apr 4, 2022 at 1:29 PM Mickaël Salaün wrote: >> >> This initial proposal was using a new faccessat2(2) flag: >> AT_INTERPRETED, see >> https://lore.kernel.org/all/20200908075956.1069018-2-mic@digikod.net/ >> What do you think about that? I'm happy to get back to this version if >> everyone is OK with it. > > I'm certainly happi_er_ with that, but I find that particular patch > odd for other reasons. > > In no particular order: > > - what's with the insane non-C syntax? Double parentheses have no > actual meaning in C: > > if ((flags & AT_INTERPRETED)) { > if ((mode & MAY_EXEC)) { > > so I don't understand why you'd use that strance thing. I guess it comes from a previous version that ANDed two booleans. > > - why is this an AT_INTERPRETED flag? I don't understand the name, I > don't understand the semantics. I wasn't sure it was a good idea to add another mode bit, so I ended up using a flag to not break compatibility of other mode checks but extend the semantic to interpreted scripts. But I agree that a new mode makes sense. > > Why would that flag have the same value as AT_SYMLINK_FOLLOW? It was a bug. > > Why isn't this just a new _mode_ bit, which is what I feel is > sensible? We only use three bits (with no bits set meaning > "existence"), so we have *tons* of bits left in that namespace, and it > would make much more sense to me to have > > #define EXECVE_OK 8 > > which is the same as the "group exec" bit, so it actually makes > some kind of sense too. Looks fine to me. The "EXECVE_" prefix is a bit weird but it will not be defined in the kernel like X_OK and others anyway, and as you said, it matches S_IXGRP. > > - related to that "I don't understand the semantics", the > "documentation" for that thing doesn't make sense either: > > + The > + main usage is for script > + interpreters to enforce a policy > + consistent with the kernel's one > + (through sysctl configuration or LSM > + policy). */ I'll synchronize the documentation with a next series. > > Now, what I *think* you mean is See a following email in reply to Kees. [...] > > And yes, we still need to talk details: > > - no backwards compatibility issues, because we've happily always > checked 'mode' for being valid, so old kernels will always return > -EINVAL. > > - POSIX namespace issues for EXECVE_OK means that the name probably > needs some thinking (maybe we just need to call it __ACCESS_OK_EXECVE > internally or something - the kernel actually doesn't even export the > existing [FRWX]_OK values, because we "know" they map tho the usual > "owner RWX" bits, with F being "no bit set") Right, I cannot find a better name for now. See a following email in reply to Kees. [...] > > So to recap: I'm very much ok with some access() extension, but I > think even that very much needs clarification, and the existing patch > is just odd in many many ways. This v8 was kind of an early version, I'll update everything. Thanks!