From patchwork Fri Jun 23 11:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 112076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5692303vqr; Fri, 23 Jun 2023 04:16:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RcXDMdTz/Yzez3GkqSKsffLzR3RWFaMvZF7ruFb/Mxv0eq17CQoRg2kJuv1ElA0P6OF9p X-Received: by 2002:a05:6a20:431f:b0:125:aeeb:f8f1 with SMTP id h31-20020a056a20431f00b00125aeebf8f1mr1193732pzk.40.1687518995017; Fri, 23 Jun 2023 04:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687518995; cv=none; d=google.com; s=arc-20160816; b=EdwnbO7pEbbfRY2Dxh/k4PYm0jd6bBVFveTcOplUzHz/ybiq+t5+EfMJfbmh4fFli2 Fuv1WAkWaZy9GwhF+UG981qbMEY3J/8uAnXXwMyFSo+GhloxKd27gaONz/rRk2bD2Mi0 PUwtJ9x2lG5MIo0lJq0VOGB9DNiWiElu83k/24NzvrkzRImkufrX2TMJ+YYziIjR+UA/ 0c6myVTj/t2BXvXjXjK3oqCX1pT98mUxIs7peVuNtEs6QT9qOMTwDvXuMnpxzJkD3byr CMzTI4OE2Dr0jW0jkJ/XzZdftmU50wi64xDbPPXeWqFuE1RqhZikdx7s3V1OoE3HSfYQ uzZA== 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=f0VodzPEDQcX9JjZJBEDkNzZARXLsoiBYtSqjF6vfi8=; b=Pi+zB+S5uhMBo5nQNtbfZZXQUoWDx1rbrExly2ibLZu2IY9UM9f+PpPxXrBsMXJCy/ ebaAgO9cjx+ZEbquP/ewFXiyzI1XxomhxB/1LwIesfsM2Sa3NviApUW2F7yzGegdG3eK 7tRijG5P/3uI77UT2TNCJw+Kc696xVvvwiYDOcshoiy+mbQSmCzPde4k2oT7fWdOcgz3 Lb1QyE8Mc7LnXtJzyHRYwv99oxJIAPsJOGp5xdbtuiGibgAiIQUW3+8Nnic08aRmbpkf eKpCpP9t1IhSOEUDdC1+9992fhmgjHlXJ6Uxx7OM9kPB5BA6gNqhWi1EY+IAT4ODzXPq 3Zhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TlbMDcQx; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a170902d89200b001ab06251f98si8146247plz.429.2023.06.23.04.16.22; Fri, 23 Jun 2023 04:16:34 -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=TlbMDcQx; 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 S231925AbjFWLO3 (ORCPT + 99 others); Fri, 23 Jun 2023 07:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbjFWLOR (ORCPT ); Fri, 23 Jun 2023 07:14:17 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C65E62101 for ; Fri, 23 Jun 2023 04:14:16 -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 770E41F6E6; Fri, 23 Jun 2023 11:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1687518855; 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=f0VodzPEDQcX9JjZJBEDkNzZARXLsoiBYtSqjF6vfi8=; b=TlbMDcQxYXlK/x5u7ubvCPwPsUHKpUfZI2GFCE+ITXT1GnMRj8C7W0StJCYva9t3+f64O/ Fc6BaA9+wdK3ikB7F0nzb7Lxkn3Fn/eymNPmyTu4Z51VD2wn5JZ63vwZKARBD6R1AOiX+T TdRl3S2TG4GGIFFOhbEqDYmOQs8iEmY= 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 220221331F; Fri, 23 Jun 2023 11:14:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mNOEBYd+lWTcFAAAMHmgww (envelope-from ); Fri, 23 Jun 2023 11:14:15 +0000 From: Nikolay Borisov To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, mohocko@suse.com, jslaby@suse.cz, Nikolay Borisov Subject: [PATCH v4 4/6] x86/elf: Make loading of 32bit processes depend on ia32_enabled() Date: Fri, 23 Jun 2023 14:14:07 +0300 Message-Id: <20230623111409.3047467-5-nik.borisov@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230623111409.3047467-1-nik.borisov@suse.com> References: <20230623111409.3047467-1-nik.borisov@suse.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769491917754868545?= X-GMAIL-MSGID: =?utf-8?q?1769491917754868545?= Major aspect of ia32 emulation is the ability to load 32bit processes. That's currently decided (among others) by compat_elf_check_arch(). Make the macro use ia32_enabled() to decide if IA32 compat is enabled before loading 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,