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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 8E805C282CE for ; Wed, 24 Apr 2019 15:38:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EF2921773 for ; Wed, 24 Apr 2019 15:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731523AbfDXPij (ORCPT ); Wed, 24 Apr 2019 11:38:39 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:13814 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730724AbfDXPii (ORCPT ); Wed, 24 Apr 2019 11:38:38 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id B15914C942; Wed, 24 Apr 2019 17:38:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id BRyV7buvG8Hj; Wed, 24 Apr 2019 17:38:23 +0200 (CEST) Date: Thu, 25 Apr 2019 01:38:06 +1000 From: Aleksa Sarai To: Kees Cook Cc: 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: <20190424153806.64qkkmkudzodxnz2@yavin> References: <20190320143717.2523-1-cyphar@cyphar.com> <20190325130429.dbrgjxnvq3w5cpb3@yavin> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gwuxm2y5lqyvv4zh" Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org --gwuxm2y5lqyvv4zh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-04-23, Kees Cook wrote: > On Mon, Mar 25, 2019 at 6:05 AM Aleksa Sarai wrote: > > On 2019-03-21, Andy Lutomirski wrote: > > > On Wed, Mar 20, 2019 at 7:38 AM Aleksa Sarai wrot= e: > > > > Now that the holiday break is over, it's time to re-send this patch > > > > series (with a few additions, due to new information we got from > > > > CVE-2019-5736 -- which this patchset mostly protected against but h= ad > > > > some holes with regards to #!-style scripts). > > > > > > I generally like this, but, as Linus pointed out, it will be > > > unfortunate if application authors see this as just another > > > non-portable weird Linux API and don't use it. Would it be worthwhile > > > to put some thought into making it an API that other OSes might be > > > willing to implement? As it stands, the openat(2) flags are getting > > > rather crazy in this patch set. >=20 > I think many of the issues are specific to Linux (and Linux containers > especially), so I'm not sure this should get blocked because we want > something more portable. I agree these issues are quite Linux-specific (*especially* the ability to re-open fds through /proc and the existence of "magic links"). However, I feel there are a few more good reasons for resolveat(2): * 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. * resolveat(2) allows for improvement to the O_PATH interface, which I think might be necessary (completely separately to this patchset). I've been working on a patchset which would make nd_jump_link() transitions in trailing_symlink() depend on the mode of the magic link being traversed through (this would allow us to block a read-only fd being re-opened as a read-write fd or similar such nonsense). One aspect of this could be to allow userspace to enable certain re-opening operations by passing a "link mode" to resolveat(2). * I would argue that O_PATH should've been a separate syscall from the beginning, given how different its semantics are to other openat(2) flags (not to mention how O_PATH is incompatible with and thus ignores so many other openat(2) flags). * If we end up needing a resolveat(2) for any of the above reasons, then we will have wasted quite a few openat(2) flag slots for naught. (Then again, there are plenty of flag slots still left.) All of that aside, what I'd really like to know is what I should do to get this patchset reviewed and merged. It's been largely radio-silence for the last few revisions. A simple resolveat(2) is fairly trivial (I have a version of it lying around somewhere), but it doesn't make sense to polish it if there's no chance Al is interested in it. > This series provides solutions to so many different race and confusion > issues, I'd really like to see it land. What's the next step here? Is > this planned to go directly to Linus for v5.2, or is it going to live > in -mm for a while? I'd really like to see this moving forward. Given some of the security requirements of this interface, I think getting it to live in -mm wouldn't be a bad idea so folks can shake the bugs out before it's depended on by container runtimes. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --gwuxm2y5lqyvv4zh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEb6Gz4/mhjNy+aiz1Snvnv3Dem58FAlzAgtoACgkQSnvnv3De m5+Qng//UgytI5RxPSbDQDbFvQ7hXxQeK7Hj2F//aO1N7wMcdXddaLGl4k2psrcy 8XV3uLPZGMGIk5O73Ll1vlvikJo6epmauB2Uft0ZmlsseL8lz3cOxnUmrr2DBlAZ 2amB5VzXSLHjwrr351CKUXnOisEIy9aWlhWqb+hjS5MObaVb2GLqrv1sf8pIcd9k fmUwbDYEAhjLLan+WZnaI1OzE5xf/kvCvb2J4XL0nXK5jbcCravxrvTdt/jGh+Bk erdQ8n5XdhpQ8bGFKaxQavKkIqmwWf70d7HV4K/pTyWqmE4zdc+F29ZvM4a2XAHa cRovUeJY26ZD9yuhWLqaswBCM+AkAYQ4E5k6CbRMpYQyJM9i4B5j/s8ZMeyqHknJ IvFN2hWLesU96bQYM8aUxdx8yM5v71fAKwk1O5pAc1QIiDOja3ua8wfSOiyBvKP1 QXm6wfyqbzj7qBpQ11Gh2cvFKrbq2OLGN59sbM/DHAs8PfhaDvtJstzL7xJ8zaWE B+GJorQxpHXP8HIKu+XbE5yezapmBKhcRTJcjaQDBjuzMxk7hUS+4J0+mOBL9cAz b885AoiI2QkdaO2bNEmRHj/jHj9Tdbmin91UPFXOMCUqcbDegpYYKb0to9hRX+g3 IFC9pwuXt7hxEqNbVr8XT73fzA+/eJx7ngaoZU107fUNR0sr8xU= =23Y4 -----END PGP SIGNATURE----- --gwuxm2y5lqyvv4zh--