Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp966792imu; Thu, 13 Dec 2018 07:20:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xb63xS3RsRQnc/W6imThbCaSjlRXTs7e2rSWqdnR837QvP5WKjXvtzCgvfXqu+gvgMUipe X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr24622118plq.286.1544714452934; Thu, 13 Dec 2018 07:20:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544714452; cv=none; d=google.com; s=arc-20160816; b=qYa+h9L9NhC8hwrKDHKR0IPEPqCaYuJiIIeIj8lq2hiznn5Gc1gFhO5ITeVKOFS2fI j09nMAFN9Ci6z2pV28V6TU7LcimsykJla9IgtYO/RwfG15XkJb1yKPmoJ6+cfCENhOZI CduogrENN/aMz/dGY9sCK9AxfVLinY1JBtwTxZAbT028XNnbPGaLhBcl0rW5XhtKfIgD XeygaG6guvn+kNrX4oHEMPJoUchO9+n32vN7CW1+fYWBgbMh7Uh2WuvXnSE1YEQ//3va L/CnTAxumfXwZCAI1t+UaUQQbT1MuwOseNLzwuK+FyVw0yHdSsBSLk4Xpz9aco6FqzJB JwvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=PenU4JL+79beKCJzDJl4HgFpHcAqnr83oafndd1llK8=; b=ps1svlowlfI3g3TUBcrcSONBWUofeZyghqUVLPd/tkUPpKNmuXMAtE6BfrpE4HrZUF Ji1cyqZtAmXm2fyVxkUuglbEFeEpuoBkBME6cFlvBCOlMhXnU6HMeLQ/m1vTAoRCp8kV Io8RaPSxGRQYaQTERt5KHojpaGk7TmFlH/vQyxmYEIzb6OI2cZESUENbRfzpYOKFMmuK i3FT/Krl7E1Rv8qcJPedmaOt5DnS9rTv86f7Vhgn+u9/u3YpIzVbHli/oWhbLCCsT9Am 9TR/mrzJC0oQCuvI5c9rQKjgIFgEPwNBCIpog+Gq4MHcQ5rXRKyktdhHTr8/653Gy4h5 RLIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ssi.gouv.fr header.s=20160407 header.b=qJOY8rrX; 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 g184si1641022pfb.288.2018.12.13.07.20.25; Thu, 13 Dec 2018 07:20:52 -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=@ssi.gouv.fr header.s=20160407 header.b=qJOY8rrX; 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 S1729275AbeLMPRZ (ORCPT + 99 others); Thu, 13 Dec 2018 10:17:25 -0500 Received: from smtp-out.ssi.gouv.fr ([86.65.182.90]:57048 "EHLO smtp-out.ssi.gouv.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727618AbeLMPRY (ORCPT ); Thu, 13 Dec 2018 10:17:24 -0500 Received: from smtp-out.ssi.gouv.fr (localhost [127.0.0.1]) by smtp-out.ssi.gouv.fr (Postfix) with ESMTP id 8B35CD0006B; Thu, 13 Dec 2018 16:17:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ssi.gouv.fr; s=20160407; t=1544714250; bh=EuHsQ6GWc5Tr1uLB3uYwH7N2PEOAZlS73ksHrDAeF7I=; h=Subject:To:CC:References:From:Date:In-Reply-To:From:Subject; b=qJOY8rrX9R0loICN/+LuPkbU3OvJbhY8HFfhiTZH+chZISDjn8Ne4fDNMml/1xIAo OduGR46t4GbNgamspNNkw7Krv0IvKyLnKvfh9vWbt6OjLh8xM70KOPdkHw9YBGxMZw AlQcM8dHWFRuQ3ddBjVArp4U2RVHlACmANXKSAypn+7vyYIzOkjU64+TLeG20hxvU3 2muBIE7loR2C0imVHGZlzwYpViafP+UVXUM1XF/jPIJvuFI/6bOe50BcrH9Ub8NNGY I17iR5MIVhRxerIAI4OiqLYjWJfwPR+NB2a9MwNJiq4NwRDDnwkWph0PRbUTiQTzHo SKSrgXXvHhRXg== Subject: Re: [RFC PATCH v1 0/5] Add support for O_MAYEXEC To: Matthew Wilcox , =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= CC: , Al Viro , James Morris , Jonathan Corbet , Kees Cook , Matthew Garrett , Michael Kerrisk , Mimi Zohar , =?UTF-8?Q?Philippe_Tr=c3=a9buchet?= , Shuah Khan , Thibaut Sautereau , Vincent Strubel , Yves-Alexis Perez , , , , References: <20181212081712.32347-1-mic@digikod.net> <20181213030228.GM6830@bombadil.infradead.org> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <374ea88c-edc5-f1a6-3637-748635e1e7df@ssi.gouv.fr> Date: Thu, 13 Dec 2018 16:17:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20181213030228.GM6830@bombadil.infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/12/2018 04:02, Matthew Wilcox wrote: > On Wed, Dec 12, 2018 at 09:17:07AM +0100, Mickaël Salaün wrote: >> The goal of this patch series is to control script interpretation. A >> new O_MAYEXEC flag used by sys_open() is added to enable userland script >> interpreter to delegate to the kernel (and thus the system security >> policy) the permission to interpret scripts or other files containing >> what can be seen as commands. > > I don't have a problem with the concept, but we're running low on O_ bits. > Does this have to be done before the process gets a file descriptor, > or could we have a new syscall? Since we're going to be changing the > interpreters anyway, it doesn't seem like too much of an imposition to > ask them to use: > > int verify_for_exec(int fd) > > instead of adding an O_MAYEXEC. > Adding a new syscall for this simple use case seems excessive. I think that the open/openat syscall familly are the right place to do an atomic open and permission check, the same way the kernel does for other file access. Moreover, it will be easier to patch upstream interpreters without the burden of handling a (new) syscall that may not exist on the running system, whereas unknown open flags are ignored.