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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 13E08C5ACD7 for ; Tue, 17 Mar 2020 17:51:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAD6A20735 for ; Tue, 17 Mar 2020 17:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbgCQRvs (ORCPT ); Tue, 17 Mar 2020 13:51:48 -0400 Received: from smtp-190a.mail.infomaniak.ch ([185.125.25.10]:39949 "EHLO smtp-190a.mail.infomaniak.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbgCQRvs (ORCPT ); Tue, 17 Mar 2020 13:51:48 -0400 Received: from smtp-2-0001.mail.infomaniak.ch (unknown [10.5.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4884010045F29; Tue, 17 Mar 2020 18:51:46 +0100 (CET) Received: from ns3096276.ip-94-23-54.eu (ns3096276.ip-94-23-54.eu [94.23.54.103]) by smtp-2-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 48hghx0Jy5zls2l2; Tue, 17 Mar 2020 18:51:45 +0100 (CET) Subject: Re: [RFC PATCH v14 06/10] landlock: Add syscall implementation To: Al Viro Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Greg Kroah-Hartman , James Morris , Jann Horn , Jonathan Corbet , Kees Cook , Michael Kerrisk , =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , "Serge E . Hallyn" , Shuah Khan , Vincent Dagonneau , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, x86@kernel.org References: <20200224160215.4136-1-mic@digikod.net> <20200224160215.4136-7-mic@digikod.net> <20200317164709.GA23230@ZenIV.linux.org.uk> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: Date: Tue, 17 Mar 2020 18:51:44 +0100 User-Agent: MIME-Version: 1.0 In-Reply-To: <20200317164709.GA23230@ZenIV.linux.org.uk> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/03/2020 17:47, Al Viro wrote: > On Mon, Feb 24, 2020 at 05:02:11PM +0100, Mickaël Salaün wrote: > >> +static int get_path_from_fd(u64 fd, struct path *path) > >> + /* >> + * Only allows O_PATH FD: enable to restrict ambiant (FS) accesses >> + * without requiring to open and risk leaking or misuing a FD. Accept >> + * removed, but still open directory (S_DEAD). >> + */ >> + if (!(f.file->f_mode & FMODE_PATH) || !f.file->f_path.mnt || > ^^^^^^^^^^^^^^^^^^^ > Could you explain what that one had been be about? The underlined > subexpression is always false; was that supposed to check some > condition and if so, which one? > This was just to be sure that the next assignment "path->mnt = f.file->f_path.mnt;" always creates a valid path. If this is always true, I will remove it.