From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Subject: Re: [RFC PATCH v14 06/10] landlock: Add syscall implementation Date: Tue, 17 Mar 2020 18:51:44 +0100 Message-ID: References: <20200224160215.4136-1-mic@digikod.net> <20200224160215.4136-7-mic@digikod.net> <20200317164709.GA23230@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Return-path: Received: from smtp-42aa.mail.infomaniak.ch ([84.16.66.170]:59141 "EHLO smtp-42aa.mail.infomaniak.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgCQRvs (ORCPT ); Tue, 17 Mar 2020 13:51:48 -0400 In-Reply-To: <20200317164709.GA23230@ZenIV.linux.org.uk> Content-Language: en-US Sender: linux-arch-owner@vger.kernel.org List-ID: 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 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.