Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2620197rwd; Fri, 16 Jun 2023 06:14:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7q8pV+zvjIVKkk57OtG1C3K00UVWbdxAD20NpMNcayC4MzKGrKBTAkV8uieYJZohCa0Eev X-Received: by 2002:a05:6a20:e615:b0:111:366:eeb2 with SMTP id my21-20020a056a20e61500b001110366eeb2mr2124230pzb.9.1686921240314; Fri, 16 Jun 2023 06:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686921240; cv=none; d=google.com; s=arc-20160816; b=Dcsh4Lk3jJlTdPqTlXlxGqC4dNQhVU67VXw/F2AVztBP5nIV+Yr58HuVC/uSyNKpx2 j4KyzBVz70hCTzPs8vT9uEYhAuuNgDRCXMT9XJERV8zW5xapYoQvlOEJcsNPGcI/wJVI XRI6tswYAggYjar9V1Q2G+rJ8Fbx5Q5+v3rDlVNP+Ib30KHZTfWDhbF5h3iBuJMyDdmV SDtVut+y/h4OJ3schGS4Wn03k6BhBaJ90IARNV7TWON3K0pZXLMpaoz6rOOmZv0Lylk/ h8n/uo19HYVkqTFxMNzRXf5QdH+qTHQONK0hRCC0AaO7BG3Bxrwn09goRPz10cEqeF1Q uf9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uebKOiOaouuF4hP+m2W8QMLwwo8lvdplmN5LTEefmQs=; b=xQZf0rFiEfqpIma3PQUS14xXS9cF5Of88vMVRVvWaBxrV9M6VSZPvts9iCevjj1OrZ RPOqB2TGtqxAHE+FCtI7SyuzPxISk3nFXwqyoa5M91jjj/7JweER1wG0TjWFYUAkfbAL g517fPVN/NSOOMt07wLhfQp1vEzGHiWG1ntf2hE3X4Oy//hTkzbB6OutdUkKIM9zeBVH Nx7NN/xT8+XGuqe/B/91D9EjgtQLRffibScgCVeAgEx/4edXDhCDdXTYEugGhGV6xd9k hs3kf8l+cCWx3gD/9drwdkDa7fhy93pMfGZGbqCfA6W2e67nU5ITv1kRH7XDLIeDIYUS KmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ApQssAVD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a63a84c000000b0054392750edfsi3092249pgp.744.2023.06.16.06.13.46; Fri, 16 Jun 2023 06:14:00 -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=@suse.com header.s=susede1 header.b=ApQssAVD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345545AbjFPM6E (ORCPT + 99 others); Fri, 16 Jun 2023 08:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345513AbjFPM5y (ORCPT ); Fri, 16 Jun 2023 08:57:54 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 898F5358C for ; Fri, 16 Jun 2023 05:57:53 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 071211F8AC; Fri, 16 Jun 2023 12:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686920272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uebKOiOaouuF4hP+m2W8QMLwwo8lvdplmN5LTEefmQs=; b=ApQssAVDFiBkb791JaTp+XIxktjd23BYoBaEWhjnIkcR4UR6Ziljlnuq8PkAWp36ZWfp7h jRcdbUm7Ja7zjBEJRkdn4nGYBEExEXV4DKGne1uxAa6iUzNJXHCIvyNcaMiWdhX2FpuraS puIfvomTJiZ+hOjOPGeaATq5oWT8POs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A41371330B; Fri, 16 Jun 2023 12:57:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aHRnJU9cjGTjNwAAMHmgww (envelope-from ); Fri, 16 Jun 2023 12:57:51 +0000 From: Nikolay Borisov To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, mhocko@suse.com, jslaby@suse.cz, Nikolay Borisov Subject: [PATCH v3 4/5] x86/elf: Make loading of 32bit processes depend on ia32_enabled() Date: Fri, 16 Jun 2023 15:57:29 +0300 Message-Id: <20230616125730.1164989-5-nik.borisov@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616125730.1164989-1-nik.borisov@suse.com> References: <20230616125730.1164989-1-nik.borisov@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Major aspect of ia32 emulation is the ability to load 32bit processes. That's currently decided (among others) by compat_elf_check_arch(). Make this macro also consider the runtime state of ia32 emulation before allowing to load a 32bit process. Signed-off-by: Nikolay Borisov --- arch/x86/include/asm/elf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 18fd06f7936a..a0234dfd1031 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -149,7 +150,7 @@ do { \ ((x)->e_machine == EM_X86_64) #define compat_elf_check_arch(x) \ - (elf_check_arch_ia32(x) || \ + ((elf_check_arch_ia32(x) && ia32_enabled()) || \ (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64)) static inline void elf_common_init(struct thread_struct *t, -- 2.34.1