Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2179584ybe; Sat, 7 Sep 2019 10:18:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGdSbgSFR19mOGVD1N20L5xylVaDipj6GT97VSlMsrqcB+rQVyCR+rMp7KxbTcP+moEkaW X-Received: by 2002:aa7:9508:: with SMTP id b8mr17755158pfp.36.1567876688116; Sat, 07 Sep 2019 10:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567876688; cv=none; d=google.com; s=arc-20160816; b=ngqYIkM7yUWDuAo/Hm85p4mN0ZRoT1oXRqVuq3PeyvHieELiLGKa+OkfrkhaHBBNsu TYj8bawuuTiSD5+Hqqir2G7VsNx0ZzhyUzDu8yglLvS4bCVCqhgMMJ0JeU2jv5BnU9mg KCzr30AyeUBHJm16iURKeHEL6iEkyy0tuQDjbqRJsXQHhbp996M1RQa6ryRuhAjpyrVM 3xr/EloPfFJn9KtX/TnngVqs6u1Q4+bTEAlctdXWVmYH6yz8iMXg1X+ouSg0GmG4u1Td iKkW5ReGz3Q0CeQDOybMiJRYlcsfM8ueAlK0Vymvszi/P3cYfwfiY9IQvFhCs0x6wNuf WHvg== 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 :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=YhAmJuUtY7qPdTz9UhHfEYRHMkBnD8hcCX0338n4RXg=; b=lstlMSbMEMbJatJR/3J3SK7Oxm229pXCrl97yAFTGNv3sS3o1/qbXWagSvMnFFgvif 8tUjo6HMS54s+43/JCjFduOjl/5pHZmj+uClQSz1hAfF4wXT5E2lJcAblMPc2LofW5j2 ltV2KE6Dcg/Qc+hWI1GmCZsfl7VcGs4AtD2+lZgOaDZmCGHY/mza5XMoVKF4M0nYfgii /V7AGmxKEJ2ePGhHkAFhoYWjTnFPNcjJT8JVTu+EL6QjRwsXXyuFiVOF33Bkc49MGFgy ez5jD6yvotPxB0H/VMc+R6RZQyrnGV2NgbXRjR9IBHZq8Ru1tOQVWBwZbWqpqhAksVsO sVPQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si8283897pll.79.2019.09.07.10.17.52; Sat, 07 Sep 2019 10:18:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392762AbfIFTHX (ORCPT + 99 others); Fri, 6 Sep 2019 15:07:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729131AbfIFTHX (ORCPT ); Fri, 6 Sep 2019 15:07:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0877830860BF; Fri, 6 Sep 2019 19:07:23 +0000 (UTC) Received: from x2.localnet (ovpn-117-48.phx2.redhat.com [10.3.117.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A44560BF7; Fri, 6 Sep 2019 19:07:20 +0000 (UTC) From: Steve Grubb To: Florian Weimer Cc: =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= , 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 , =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= , Mimi Zohar , Philippe =?ISO-8859-1?Q?Tr=E9buchet?= , Scott Shell , Sean Christopherson , Shuah Khan , Song Liu , Steve Dower , Thibaut S autereau , 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 Subject: Re: [PATCH v2 0/5] Add support for O_MAYEXEC Date: Fri, 06 Sep 2019 15:07:19 -0400 Message-ID: <1802966.yheqmZt8Si@x2> Organization: Red Hat In-Reply-To: <87mufhckxv.fsf@oldenburg2.str.redhat.com> References: <20190906152455.22757-1-mic@digikod.net> <2989749.1YmIBkDdQn@x2> <87mufhckxv.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 06 Sep 2019 19:07:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, September 6, 2019 2:57:00 PM EDT Florian Weimer wrote: > * Steve Grubb: > > Now with LD_AUDIT > > $ LD_AUDIT=/home/sgrubb/test/openflags/strip-flags.so.0 strace ./test > > 2>&1 | grep passwd openat(3, "passwd", O_RDONLY) = 4 > > > > No O_CLOEXEC flag. > > I think you need to explain in detail why you consider this a problem. Because you can strip the O_MAYEXEC flag from being passed into the kernel. Once you do that, you defeat the security mechanism because it never gets invoked. The issue is that the only thing that knows _why_ something is being opened is user space. With this mechanism, you can attempt to pass this reason to the kernel so that it may see if policy permits this. But you can just remove the flag. -Steve > With LD_PRELOAD and LD_AUDIT, you can already do anything, including > scanning other loaded objects for a system call instruction and jumping > to that (in case a security module in the kernel performs a PC check to > confer additional privileges). > > Thanks, > Florian