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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64FDFC433F5 for ; Wed, 20 Apr 2022 16:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239724AbiDTQyO (ORCPT ); Wed, 20 Apr 2022 12:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiDTQyM (ORCPT ); Wed, 20 Apr 2022 12:54:12 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3D13E0CD for ; Wed, 20 Apr 2022 09:51:26 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id x80so2494696pfc.1 for ; Wed, 20 Apr 2022 09:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=75aEtLVVskQwplfG1XbK/PPMy44vZPZUgB+8LUXq4M4=; b=emgn1y9ywqnwNFhPxR5f9njVHoOQc9+qc35Oi3HPEEzdMfTlNOeJ/8jtrkZBju1aKc AEFLNWFZF8+qXlNuivoviaxx9csH51ZGvDQzblwjNCWNStS0GS/9RPIEMoHu9M+O+2aj +jW8hz60xNIh4GsXUOSMyyhnw/VMa9F/pN/oA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=75aEtLVVskQwplfG1XbK/PPMy44vZPZUgB+8LUXq4M4=; b=n68JCP3QHbcKtiGspbuoCNLFN+oj6Tix9oOHLYyxlqlzTgmOtIc2DXlF1hEvLoy6Dr mM9/+SxkDTwO7Pbq3ssEKGvsJSBIYzvS6nPX5ifossBclW7vYatLX6G3QDxIXDCYfnWb sT3ufKMlm+Eq/r26acIZFi9VyRgpkMfpfvSvabTQfSeWD21j47Zv+1zuOHXVKZrtWw1P CzquPdTtDO+0KYhEIOUbUU9XgARuD6gmmZ6nKmgMlKKmItG/l5ZSFcFV09aruT3IBui3 ntEMxdimoqQZxWQnIAUCASqdVVJU3ebWYtl/MW7OXyQS3kWwtyWNqslWMTkkOnin9F4O yjPA== X-Gm-Message-State: AOAM531euiUWcStvCNoKBJviL3gg+mBlkwJrQsgP+TdGua9QdGCkVkw7 QMrRttVbhTWkPgu5OoUXJTrCHg== X-Google-Smtp-Source: ABdhPJwBhq5nUAt/GWX1jJoxxnvjt8PlAWyO9xz4E4dpr0gW4ecUCqHufOp+thKUgWbRKKCVCUg1ow== X-Received: by 2002:a63:6c8a:0:b0:398:5208:220a with SMTP id h132-20020a636c8a000000b003985208220amr20113824pgc.176.1650473485783; Wed, 20 Apr 2022 09:51:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r32-20020a17090a43a300b001cdbda883ccsm278919pjg.38.2022.04.20.09.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 09:51:25 -0700 (PDT) Date: Wed, 20 Apr 2022 09:51:24 -0700 From: Kees Cook To: Mark Brown Cc: Catalin Marinas , Will Deacon , Szabolcs Nagy , Jeremy Linton , "H . J . Lu" , Yu-cheng Yu , Eric Biederman , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, libc-alpha@sourceware.org, Dave Martin Subject: Re: [PATCH v13 1/2] elf: Allow architectures to parse properties on the main executable Message-ID: <202204200951.24D7A5A24@keescook> References: <20220419105156.347168-1-broonie@kernel.org> <20220419105156.347168-2-broonie@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220419105156.347168-2-broonie@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Tue, Apr 19, 2022 at 11:51:55AM +0100, Mark Brown wrote: > Currently the ELF code only attempts to parse properties on the image > that will start execution, either the interpreter or for statically linked > executables the main executable. The expectation is that any property > handling for the main executable will be done by the interpreter. This is > a bit inconsistent since we do map the executable and is causing problems > for the arm64 BTI support when used in conjunction with systemd's use of > seccomp to implement MemoryDenyWriteExecute which stops the dynamic linker > adjusting the permissions of executable segments. > > Allow architectures to handle properties for both the dynamic linker and > main executable, adjusting arch_parse_elf_properties() to have a new > flag is_interp flag as with arch_elf_adjust_prot() and calling it for > both the main executable and any intepreter. > > The user of this code, arm64, is adapted to ensure that there is no > functional change. > > Signed-off-by: Mark Brown Acked-by: Kees Cook -- Kees Cook 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A35D8C433EF for ; Wed, 20 Apr 2022 16:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AGLHNZZX5rf6t23Fm/osVtKq0J5/1wii8B88rxGsu54=; b=Ta/aUB7mS7daeR i97EnGvnW55h82hSN5zTeX+aFAzCArE83l+A3ANQJtuYnxinGHN+HyERC6BP8y/ov7PNI/zluDXvm VmWPQqIt3sFPED6pVEr/wOZ7C0wRhLC6g1ObJvJdBP4JwzIqMNjhUE5sYym4FdkefPqIIIJA4mnIY WkjTAxPzA4T0RpaHYmDZnsBEUZhkbayuZCJlsIY18HAq/RWPiBy0Caoz14YwAjkKhb8xINaTuYBZe b9zk8Kx7P8405IJShUrLO7T1FLXT4Qp5f2CaNMzzF2DLSBgaD118h9PFkXI+H7kLbri0aNyNHogUP qEEV1SEcSaoOr/2mUfjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhDa7-009ldU-Nb; Wed, 20 Apr 2022 16:53:31 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhDY8-009kag-IJ for linux-arm-kernel@lists.infradead.org; Wed, 20 Apr 2022 16:51:30 +0000 Received: by mail-pf1-x432.google.com with SMTP id b15so2477331pfm.5 for ; Wed, 20 Apr 2022 09:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=75aEtLVVskQwplfG1XbK/PPMy44vZPZUgB+8LUXq4M4=; b=emgn1y9ywqnwNFhPxR5f9njVHoOQc9+qc35Oi3HPEEzdMfTlNOeJ/8jtrkZBju1aKc AEFLNWFZF8+qXlNuivoviaxx9csH51ZGvDQzblwjNCWNStS0GS/9RPIEMoHu9M+O+2aj +jW8hz60xNIh4GsXUOSMyyhnw/VMa9F/pN/oA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=75aEtLVVskQwplfG1XbK/PPMy44vZPZUgB+8LUXq4M4=; b=P7/wJ55edAjvU6PcN7uPCkUpYXPrYzlK1KGIr1JjtcAbT2dTTGRWAUIk+gMGqbHqtG 6bGsJshYJmm9d70SW637vSgRdi1Hd3SOHxofHSh/gTsG27pZohDf2GVTtKSUf0k7wb55 cf9YUD5zlZOdoVQEHiKFhz/XV3+xjk5PW6mx2XD52e07Ac2yz3FI8x2o8ZWNf/tcxNOG Vs0r5pH36A1BlZeNcSQU/sRfEW+QtngM+koUw9eqh5AMrsunn2W3xN2YkCNmUMv0YqI0 pB5h2pKojico0aTosqTWo7YFsTFbbIaCvwzruGu+e+yE57TLR1nIJxzGS7C72PkEqw30 y7Ew== X-Gm-Message-State: AOAM531mARVc7K3Bpi35voJ2ihqSLxbdeyenPdVOrLfZOsbxEdaVpgJz Czrkrgc4+FNX5MnmurEngMLpmQ== X-Google-Smtp-Source: ABdhPJwBhq5nUAt/GWX1jJoxxnvjt8PlAWyO9xz4E4dpr0gW4ecUCqHufOp+thKUgWbRKKCVCUg1ow== X-Received: by 2002:a63:6c8a:0:b0:398:5208:220a with SMTP id h132-20020a636c8a000000b003985208220amr20113824pgc.176.1650473485783; Wed, 20 Apr 2022 09:51:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r32-20020a17090a43a300b001cdbda883ccsm278919pjg.38.2022.04.20.09.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 09:51:25 -0700 (PDT) Date: Wed, 20 Apr 2022 09:51:24 -0700 From: Kees Cook To: Mark Brown Cc: Catalin Marinas , Will Deacon , Szabolcs Nagy , Jeremy Linton , "H . J . Lu" , Yu-cheng Yu , Eric Biederman , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, libc-alpha@sourceware.org, Dave Martin Subject: Re: [PATCH v13 1/2] elf: Allow architectures to parse properties on the main executable Message-ID: <202204200951.24D7A5A24@keescook> References: <20220419105156.347168-1-broonie@kernel.org> <20220419105156.347168-2-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220419105156.347168-2-broonie@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220420_095128_681847_E6A5471E X-CRM114-Status: GOOD ( 17.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 19, 2022 at 11:51:55AM +0100, Mark Brown wrote: > Currently the ELF code only attempts to parse properties on the image > that will start execution, either the interpreter or for statically linked > executables the main executable. The expectation is that any property > handling for the main executable will be done by the interpreter. This is > a bit inconsistent since we do map the executable and is causing problems > for the arm64 BTI support when used in conjunction with systemd's use of > seccomp to implement MemoryDenyWriteExecute which stops the dynamic linker > adjusting the permissions of executable segments. > > Allow architectures to handle properties for both the dynamic linker and > main executable, adjusting arch_parse_elf_properties() to have a new > flag is_interp flag as with arch_elf_adjust_prot() and calling it for > both the main executable and any intepreter. > > The user of this code, arm64, is adapted to ensure that there is no > functional change. > > Signed-off-by: Mark Brown Acked-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel