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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 51076C4646D for ; Thu, 25 Apr 2019 13:32:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02478208E4 for ; Thu, 25 Apr 2019 13:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbfDYNZg (ORCPT ); Thu, 25 Apr 2019 09:25:36 -0400 Received: from tartarus.angband.pl ([54.37.238.230]:36176 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfDYNZf (ORCPT ); Thu, 25 Apr 2019 09:25:35 -0400 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.92) (envelope-from ) id 1hJeKv-00077K-W9; Thu, 25 Apr 2019 15:22:49 +0200 Date: Thu, 25 Apr 2019 15:22:49 +0200 From: Adam Borowski To: Aleksa Sarai Cc: Kees Cook , Andy Lutomirski , Al Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Eric Biederman , Jann Horn , Christian Brauner , David Drysdale , Tycho Andersen , Linux Containers , Linux FS Devel , Linux API , Andrew Morton , Alexei Starovoitov , Chanho Min , Oleg Nesterov , Aleksa Sarai , Linus Torvalds , LKML , linux-arch Subject: Re: [PATCH RESEND v5 0/5] namei: vfs flags to restrict path resolution Message-ID: <20190425132249.GA26669@angband.pl> References: <20190320143717.2523-1-cyphar@cyphar.com> <20190325130429.dbrgjxnvq3w5cpb3@yavin> <20190424153806.64qkkmkudzodxnz2@yavin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190424153806.64qkkmkudzodxnz2@yavin> X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Apr 25, 2019 at 01:38:06AM +1000, Aleksa Sarai wrote: > * openat(2) ignores unknown flags, meaning that old kernels will ignore > new programs trying to use O_THISROOT and might end up causing > security issues. Yes, it'd be trivial to check whether the new O_* > flags are supported at start-up, but I think a security feature > shouldn't have a foot-gun associated with it. In fact, I didn't know > openat(2) ignored unknown flags until I wrote this patchset -- I > doubt many other userspace developers do either. For this reason, I propose every new syscall that has flags to follow a bitmask scheme, where any flag assigned a bit in the upper half returns EOPNOTSUPP when called on an old kernel. That would allow defining which flags can be safely ignored and which can't. It otherwise takes major hacks to implement a fail-if-not-supported flag while keeping compat with old kernels. For example, for mmap(), MAP_SHARED has been duplicated as MAP_SHARED_VALIDATE just to allow an unrelated flag (MAP_SYNC) to fail on old kernels. Meow! -- ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢰⠒⠀⣿⡁ Imagine there are bandits in your house, your kid is bleeding out, ⢿⡄⠘⠷⠚⠋⠀ the house is on fire, and seven giant trumpets are playing in the ⠈⠳⣄⠀⠀⠀⠀ sky. Your cat demands food. The priority should be obvious...