Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1765878ybe; Sat, 7 Sep 2019 02:27:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1hTOCaAk4StIncXuN133bfBQxFvHPlIWLcqdr2Ja5K6oSLjh3cTBJ1EY7w3WQPoi+wSto X-Received: by 2002:a17:902:780c:: with SMTP id p12mr13457873pll.290.1567848429850; Sat, 07 Sep 2019 02:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567848429; cv=none; d=google.com; s=arc-20160816; b=wNcV9kGOrPNTNKfwo8+o2/z1ORlN2yrQXKvLos4aZCIz/2tuti22qDauyxMGOoWYm3 21RSTH5OxxMCt7OLvgCHPzmcR5Qvhh6mDYPsp705CtqtoTmjHklIbZf4l5/j8DzoNP3C giSngYad4I/tIqKnDqjal5juQa92yqnlhVuHHit6sp5vyc0AObOdQkcpwoLo22PUmsxa q8wIieRzQXezA5/Q83wZFP3IOjgOmV/M5ieBxCiVUSn/Qe8wG52V0zlm6UoDKsDeqnnM 5B2WXO2DCADtir+mNZXHiC50bjVo3dOAFRlN9vlwpKxsUaVd3cbKwrvGHQyYFQYz9K6s JxWQ== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=CJKiboDrN71SPkNSqVRUWWtRXRbSf3o+Cs2E3+x9BKM=; b=iGwE+QYUxGc+GsRf2Pfc9p/FI5vWqMzYZasEiiWkBE5kEDNaeIff/zRhAUbYIEZwTa s1wWG02vL7UclZ9GaOm/BPK0mBSzFPlJ5jBqANKZdNvlSGvp/E87DYuF2P61pUEOhDVT bryPCFDdmjsGtNtifPCriwjxWpMPn7INJPMpMtZOnv9jJQ4D1jE7h5t9SmLU4tA2lHje ZjL5SEghfQ5cofUtDS1sKDBrFeMDXTMpbQ98/Q8Wx8sELoorNEmfhqE913LFeH3OrpG9 jSg26sIj4riLi8QnRdsglx1txbdYNigYt1wLa+CLGiMtmQX8gkNE+zyxmB7ZZTPAURCv hHEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f2hfBkg1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si7149495plp.96.2019.09.07.02.26.54; Sat, 07 Sep 2019 02:27:09 -0700 (PDT) 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=@kernel.org header.s=default header.b=f2hfBkg1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405945AbfIFQtF (ORCPT + 99 others); Fri, 6 Sep 2019 12:49:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405934AbfIFQtE (ORCPT ); Fri, 6 Sep 2019 12:49:04 -0400 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE05620644; Fri, 6 Sep 2019 16:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567788543; bh=xWpSJFUS4h9orrA331aLGvjdzbINh7yeaGYKw2j49vE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=f2hfBkg1hv++7RhCjFnGYFYZ7UpLwMTDlXmWlwYszll17PrezP1cyi1PEEmnh+HNN pnFT3OLPKxEOE5McxRb6hxqaoesj0DEtnoHNAQbAtp1/Ro9WmKNQ4jdHnENi4ZBFiz IKixR/rSalsZdHuMF3yJ3i0ZTpyfCcai5ni0Vlng= Message-ID: Subject: Re: [PATCH v2 1/5] fs: Add support for an O_MAYEXEC flag on sys_open() From: Jeff Layton To: =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= , Florian Weimer , =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: linux-kernel@vger.kernel.org, Aleksa Sarai , Alexei Starovoitov , Al Viro , Andy Lutomirski , Christian Heimes , Daniel Borkmann , Eric Chiang , James Morris , Jan Kara , Jann Horn , Jonathan Corbet , Kees Cook , Matthew Garrett , Matthew Wilcox , Michael Kerrisk , Mimi Zohar , Philippe =?ISO-8859-1?Q?Tr=E9buchet?= , Scott Shell , Sean Christopherson , Shuah Khan , Song Liu , Steve Dower , Steve Grubb , Thibaut Sautereau , Vincent Strubel , Yves-Alexis Perez , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org Date: Fri, 06 Sep 2019 12:48:59 -0400 In-Reply-To: <75442f3b-a3d8-12db-579a-2c5983426b4d@ssi.gouv.fr> References: <20190906152455.22757-1-mic@digikod.net> <20190906152455.22757-2-mic@digikod.net> <87ef0te7v3.fsf@oldenburg2.str.redhat.com> <75442f3b-a3d8-12db-579a-2c5983426b4d@ssi.gouv.fr> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-09-06 at 18:06 +0200, Mickaël Salaün wrote: > On 06/09/2019 17:56, Florian Weimer wrote: > > Let's assume I want to add support for this to the glibc dynamic loader, > > while still being able to run on older kernels. > > > > Is it safe to try the open call first, with O_MAYEXEC, and if that fails > > with EINVAL, try again without O_MAYEXEC? > > The kernel ignore unknown open(2) flags, so yes, it is safe even for > older kernel to use O_MAYEXEC. > Well...maybe. What about existing programs that are sending down bogus open flags? Once you turn this on, they may break...or provide a way to circumvent the protections this gives. Maybe this should be a new flag that is only usable in the new openat2() syscall that's still under discussion? That syscall will enforce that all flags are recognized. You presumably wouldn't need the sysctl if you went that route too. Anyone that wants to use this will have to recompile anyway. If the kernel doesn't support openat2 or if the flag is rejected then you know that you have no O_MAYEXEC support and can decide what to do. > > Or do I risk disabling this security feature if I do that? > > It is only a security feature if the kernel support it, otherwise it is > a no-op. > With a security feature, I think we really want userland to aware of whether it works. > > Do we need a different way for recognizing kernel support. (Note that > > we cannot probe paths in /proc for various reasons.) > > There is no need to probe for kernel support. > > > Thanks, > > Florian > > > > -- > Mickaël Salaün > > Les données à caractère personnel recueillies et traitées dans le cadre de cet échange, le sont à seule fin d’exécution d’une relation professionnelle et s’opèrent dans cette seule finalité et pour la durée nécessaire à cette relation. Si vous souhaitez faire usage de vos droits de consultation, de rectification et de suppression de vos données, veuillez contacter contact.rgpd@sgdsn.gouv.fr. Si vous avez reçu ce message par erreur, nous vous remercions d’en informer l’expéditeur et de détruire le message. The personal data collected and processed during this exchange aims solely at completing a business relationship and is limited to the necessary duration of that relationship. If you wish to use your rights of consultation, rectification and deletion of your data, please contact: contact.rgpd@sgdsn.gouv.fr. If you have received this message in error, we thank you for informing the sender and destroying the message. -- Jeff Layton