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=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 4C01BC2D0A8 for ; Wed, 23 Sep 2020 08:16:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EDAD921D43 for ; Wed, 23 Sep 2020 08:15:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z+QejtBb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDAD921D43 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=b1Fl50QsknUqAZIngYgWsXPtfrQbZ/Lx+Q1G+NFnVIU=; b=Z+QejtBbJS9uDAgMQ3awOi8ra pVSBbGCrlt7GfPAk860DqgQi24ABfU4ySDfdelUYvnD5986ALLrx+DUx+cISs9zYcfZ5O34wFMpPy pKJ5RUBKJKb1MlEXm6+pbNzt+/2BxasIpw3r2jK7zkQSpDZcLPh/SE9j1eGcZqKQeZ1nkD6Lq3KlT rFbolcMqu9nW53MU5DlRBBUa8lItqngR4iuFnp3qZqPxLElJwiu2UwD+5de5nz4ChSeCw148RkjXG b/z6v9kOBekHIUoozWbRYlZAiLVzI+uMDczmiRJ9E9vksGU5TFN9rYrnAMnI18ZXsJKwo0x+Wue5c BL5D5HlDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKzvA-00036k-BH; Wed, 23 Sep 2020 08:14:36 +0000 Received: from jabberwock.ucw.cz ([46.255.230.98]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKzv6-000340-Up for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 08:14:34 +0000 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 4B82D1C0BB9; Wed, 23 Sep 2020 10:14:27 +0200 (CEST) Date: Wed, 23 Sep 2020 10:14:26 +0200 From: Pavel Machek To: madvenka@linux.microsoft.com Subject: Re: [PATCH v2 0/4] [RFC] Implement Trampoline File Descriptor Message-ID: <20200923081426.GA30279@amd> References: <210d7cd762d5307c2aa1676705b392bd445f1baa> <20200922215326.4603-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 In-Reply-To: <20200922215326.4603-1-madvenka@linux.microsoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_041433_106265_8F503F40 X-CRM114-Status: GOOD ( 20.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fweimer@redhat.com, mark.rutland@arm.com, kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, oleg@redhat.com, mic@digikod.net, linux-security-module@vger.kernel.org, David.Laight@ACULAB.COM, luto@kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============2918572061526090378==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2918572061526090378== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ew6BAiZeqk4r7MaW" Content-Disposition: inline --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Introduction > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Dynamic code is used in many different user applications. Dynamic code is > often generated at runtime. Dynamic code can also just be a pre-defined > sequence of machine instructions in a data buffer. Examples of dynamic > code are trampolines, JIT code, DBT code, etc. >=20 > Dynamic code is placed either in a data page or in a stack page. In order > to execute dynamic code, the page it resides in needs to be mapped with > execute permissions. Writable pages with execute permissions provide an > attack surface for hackers. Attackers can use this to inject malicious > code, modify existing code or do other harm. >=20 > To mitigate this, LSMs such as SELinux implement W^X. That is, they may n= ot > allow pages to have both write and execute permissions. This prevents > dynamic code from executing and blocks applications that use it. To allow > genuine applications to run, exceptions have to be made for them (by sett= ing > execmem, etc) which opens the door to security issues. >=20 > The W^X implementation today is not complete. There exist many user level > tricks that can be used to load and execute dynamic code. E.g., >=20 > - Load the code into a file and map the file with R-X. >=20 > - Load the code in an RW- page. Change the permissions to R--. Then, > change the permissions to R-X. >=20 > - Load the code in an RW- page. Remap the page with R-X to get a separate > mapping to the same underlying physical page. >=20 > IMO, these are all security holes as an attacker can exploit them to inje= ct > his own code. IMO, you are smoking crack^H^H very seriously misunderstanding what W^X is supposed to protect from. W^X is not supposed to protect you from attackers that can already do system calls. So loading code into a file then mapping the file as R-X is in no way security hole in W^X. If you want to provide protection from attackers that _can_ do system calls, fine, but please don't talk about W^X and please specify what types of attacks you want to prevent and why that's good thing. Hint: attacker that can "Load the code into a file and map the file with R-X." can probably also load the code into /foo and os.system("/usr/bin/python /foo"). This is not first crazy patch from your company. Perhaps you should have a person with strong Unix/Linux experience performing "straight face test" on outgoing patches? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --ew6BAiZeqk4r7MaW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl9rA+IACgkQMOfwapXb+vLeswCgxLsVovoEu7Zr4CWuzSbUatKX B5wAnRA2x52GHgeeAkFmdWf8Tz3etxRA =lIi4 -----END PGP SIGNATURE----- --ew6BAiZeqk4r7MaW-- --===============2918572061526090378== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2918572061526090378==--