Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37074706rwd; Tue, 11 Jul 2023 09:07:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGsmiuST+a6Q9xTmP+8a7LBvrA1Oi2/X5eirgAPtIj2cqgic6mC8+ObK6ftLkWfmgH0YdJs X-Received: by 2002:a05:6a00:1593:b0:65e:ec60:b019 with SMTP id u19-20020a056a00159300b0065eec60b019mr15274306pfk.25.1689091644003; Tue, 11 Jul 2023 09:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689091643; cv=none; d=google.com; s=arc-20160816; b=kC+cgeZ4vBNJlvgjy9LWNnM463sC4y68sqoSiuYZ4bJHBb9nrWUA5w6sUh2JWA8LMG 4NmEVuDLHQsGdqPZFmf6tQz5uNtpfgK535AxOsnFDwrT7eUcGXLXIPcdW1qSTuZnmpaa bzEJ2Q81o66x1AIgORVln8x1d9cCgirSaFHEMrU1lvXsNGfs3qqXDjYRjOxq5QmgOrPt bjtWrhzkN6btp8GT8rxIzWXVU96o9VSlMbSSBXLGiAt/pKRrxY/GEHugYV0jH9gcV2ih 0mxUGawDQbwyz/A10pK5n2iMZ+ia8m0ILASALumhspyQAsp9516nCOEnKBANFLyXi/Zu jsog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=h0Eo8sEWwi+QlL6TwKCEAUf0c6tdOFvYOKUGXKFLpnI=; fh=rHOtpCh469xEAjD6nRc/zoWEnkSg7uL+pYnBoKQj+8M=; b=i5ZICY5k+o7gl5eUpnoexC8Z0b8QfxjUAKZ57ttpF7S7Wpsvn42+/Bsb+QUznK3iJw fgdtr+WhbdTnnzrI/dVCjuLzq/fozwerL+emG7La0tTlTjvnuhd4obo7JfqWNkMNnY55 UeaoAdOdktgBlEBQxj5dALhbUogaNM1xGfWBa89C+AI5uatIpVuEqNWrya1CtTngwF8+ dqY7Wkn/Rcwz6prmiLwGQKmShiKLN5bNRgx10eDHTZb3iTiw/i5vZbjxaSiFVPINwQ5X Hp9bSDn/tl+2kVjyufcR+sPYDJ0bVgkpU7ka7fTYvk8aSQckmuqDpjJaXLDswsnTwazT oXcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VEHl1YDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a056a0015d000b0066891ffdfd5si1683400pfu.358.2023.07.11.09.07.00; Tue, 11 Jul 2023 09:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VEHl1YDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233055AbjGKPvm (ORCPT + 99 others); Tue, 11 Jul 2023 11:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbjGKPvl (ORCPT ); Tue, 11 Jul 2023 11:51:41 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22B6EF0 for ; Tue, 11 Jul 2023 08:51:40 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-666e6ecb52dso3358028b3a.2 for ; Tue, 11 Jul 2023 08:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689090699; x=1691682699; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=h0Eo8sEWwi+QlL6TwKCEAUf0c6tdOFvYOKUGXKFLpnI=; b=VEHl1YDonMq0agfdUsVKQhxo8RItH5aI7RFQLbPPlyzgiEZLoC2QTbgKfhaUAXb0Xs mt2OV6GTXYF+7hq2+LNiL0/ACbBpJ/nlAWB7DJdT+a6lnDl//ZGmngeWOxRP9eIddcv/ F7Yri1Yx+qPeciVnr2KrQ5EVMTSFWvZEHVvVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689090699; x=1691682699; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h0Eo8sEWwi+QlL6TwKCEAUf0c6tdOFvYOKUGXKFLpnI=; b=LTnXaIkWTbU2LeXOVYKLbrZ5QIMceZZoWQuRRrWgtXTZCL9rldOilhHRkFZiMKG8Hc tegNRpifjWMbvIocL51YG4PxkIDuvDibt7bX0uCuV+60Xu6XNAw4YgEcDCrDp2UgO5+q hjG3nCjeFT3QIJuyKhW7mFpr2lXQ8Ni2+OC/+4676Awpkx6g3qodjKXbyqGkqj+37HOg kvsFNPIcF5KRWqrTnFGDPriZv0AdY4WyM/wUMBUUCe8BGweNbUcxpFKuy69RQYUGffQk km57aRCMQKESzJ9tILyYvUw2xn9nlIv2PRBHiZbH8DNp2kHI/mwYMAsyIVP76YoeuEmV /wkg== X-Gm-Message-State: ABy/qLaBhXXJ/MUqTK7RAwogqELfM3rSD+81HvzlyvikQhFNgFCAWGkd S4suHx5lF+HrWN72RKhPzlp5Xi+IA3HWEmisdBo= X-Received: by 2002:a05:6a00:22cd:b0:674:1dde:4c59 with SMTP id f13-20020a056a0022cd00b006741dde4c59mr14931253pfj.28.1689090699562; Tue, 11 Jul 2023 08:51:39 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id x13-20020aa784cd000000b00682a61fa525sm1934182pfn.91.2023.07.11.08.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 08:51:39 -0700 (PDT) Date: Tue, 11 Jul 2023 08:51:38 -0700 From: Kees Cook To: Greg Ungerer Cc: linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, palmer@dabbelt.com, viro@zeniv.linux.org.uk, ebiederm@xmission.com, brauner@kernel.org Subject: Re: [PATCH v2 1/2] binfmt_elf_fdpic: support 64-bit systems Message-ID: <202307110851.7F2EB003@keescook> References: <20230711130754.481209-1-gerg@kernel.org> <20230711130754.481209-2-gerg@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230711130754.481209-2-gerg@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 11, 2023 at 11:07:53PM +1000, Greg Ungerer wrote: > The binfmt_flat_fdpic code has a number of 32-bit specific data > structures associated with it. Extend it to be able to support and > be used on 64-bit systems as well. > > The new code defines a number of key 64-bit variants of the core > elf-fdpic data structures - along side the existing 32-bit sized ones. > A common set of generic named structures are defined to be either > the 32-bit or 64-bit ones as required at compile time. This is a > similar technique to that used in the ELF binfmt loader. > > For example: > > elf_fdpic_loadseg is either elf32_fdpic_loadseg or elf64_fdpic_loadseg > elf_fdpic_loadmap is either elf32_fdpic_loadmap or elf64_fdpic_loadmap > > the choice based on ELFCLASS32 or ELFCLASS64. > > Signed-off-by: Greg Ungerer This looks good an is consistent with what the regular ELF loader does with the sized types. Acked-by: Kees Cook -- Kees Cook