Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp177655rwo; Fri, 21 Jul 2023 10:07:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+0lDmrXXKuYjWI1xLTqy++Y6gOBCANwSa30g32WDjp40Z0RvPme5RXO4TzSCKsZwC475B X-Received: by 2002:a50:ec93:0:b0:51d:f39d:1716 with SMTP id e19-20020a50ec93000000b0051df39d1716mr1829988edr.22.1689959258572; Fri, 21 Jul 2023 10:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689959258; cv=none; d=google.com; s=arc-20160816; b=Yjx2H507eRspJsiuhi6qcm13LXNYmRKR2qgw/pkelenCrhS5jMm/HiXs+nvQx4P77h do+9eEFUiJzjdbEm2dv/czl7rWkE5UWYodnfmYj/2rma1/JMg/J1ERN3ctuSfxwkNrGe zwRrhV8Cqa5eORVQKS0/YgNsUDC1EGU44frILeRQE+MfhPqSkGmZ7ycxiAn7Q5cuD+x2 ApN10h16phf1zqFY8hd+lTM7pK1TBKQK8nMnp5JavCDlkGHPfGRGgUOqgMbRxTSK6ccp qyAuLwacvLB/VxUFLV8RsAX43+BEJWt5vbYbl8oey0+0+UUauzOMfH8VfSGHtViymPoQ H/RA== 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=tjiy+RZzhIETh3eDrX+VMpaBXAb3ySzD13mUYqdBjXY=; fh=7RNrRNWUj9CYv4UOvP3YqAuBAxHO0RPePKHqIO87VRQ=; b=0ve9nJBHYVI+18ZiOYyJRebh+EuzkBScmcBBKv3WsKk+IN/os9r8gktTTgIkYO2Wt6 6Cmyumz3j0AZC1XQOahUEQtoZImba11gG6d6dzScj58AHVIuR2cd9E8UEwZiiHoSYJBS HSgbso6J69Df7wwSL65W8wol29MrldnqRsfgkDNDBQED3rYT5Xcl6MWQ3v+Wp2kFqEtS ITLxossAXDKymqyG36N1XFACGAMBibV+jwFQYCbP9fT8VUZaUcBeBlLJ+eFDCUWCOTv1 IxaQzNx32o+RxjqhOZAN/UDs5NBTlNUcFOP46d7purOz6zwnfVaYy2coc1HGyG/GsFbh 3IEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=pBsh1Da+; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020aa7cb4d000000b0052176ba2183si2695743edt.40.2023.07.21.10.07.13; Fri, 21 Jul 2023 10:07:38 -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=@gmail.com header.s=20221208 header.b=pBsh1Da+; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbjGUQK6 (ORCPT + 99 others); Fri, 21 Jul 2023 12:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbjGUQKr (ORCPT ); Fri, 21 Jul 2023 12:10:47 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748912726 for ; Fri, 21 Jul 2023 09:10:45 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4039f7e1d3aso17432721cf.0 for ; Fri, 21 Jul 2023 09:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689955844; x=1690560644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tjiy+RZzhIETh3eDrX+VMpaBXAb3ySzD13mUYqdBjXY=; b=pBsh1Da+bk04OLuUyhhlN/h5LJWYOgP9+z1lNk/rsHS7ZZOT+N/PriVaizlB0sHCAI ec7NWcYEeAKLg9cKgMyUwEZiE6Aq2+LFWRUfGngrJS0A0Atal032dkqCOakPbSHoNKIW H8YMcUlTK2b8sqg8tCJOCZzW4QQ+3A2rxqvVa8YoNvyxkODDClEUo/06mV1v+Pu10NGm 7cqVhpCPWuj39FFW20hchaBnHx/Yvd8UnVrhqBu+sX2ddNAy0gBFjTkOxF1ysxfC6FAi SYmPDUgdk62d2pVR3k2YLDH1WfX2FrXZVsjCjHlrdMhoB4f6RTvBICAv8RDR7LNn9zAt t2yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689955844; x=1690560644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tjiy+RZzhIETh3eDrX+VMpaBXAb3ySzD13mUYqdBjXY=; b=gWhnOEvSO7Q1WnMQ5UQV7aIGNO1M1dPDVu1pUD6D6Uy+GK2kqn+JqM5IlyYfrsr5t8 4KMKERmWWBg1a9dg2YGL41P0GW/+le4hRzJ8aAG44zT7hGXevN4tydIt2I3AGjXK+Umh 1qirKJrC4oLyrxTFT3EMNaMYh9UdNhXif42WIHIXK+0yIa/mrvnEh6jAGGGXDxStbvUl y9ot7vgHuGdccSeAzDCBA7pe+Q80KQ0jOUA7OtbOzsUujb9IU1KBAiw0N27vIrKorEFv MrV6DZGfE9gZTBdfUM+9lMEEb9qp0F4iw2bDPOnl1I90oTeUM4C9nol8EnhIXNGwmwth kHpw== X-Gm-Message-State: ABy/qLZN1sTo64armZD7SpzpAY+K6JfOis/RCL58NpbXqbzp0XspLIyp VBc11nEebATqobAGGAQ4KQXz+8Nrww== X-Received: by 2002:a05:622a:184:b0:403:cb17:c108 with SMTP id s4-20020a05622a018400b00403cb17c108mr680402qtw.24.1689955843960; Fri, 21 Jul 2023 09:10:43 -0700 (PDT) Received: from citadel.. (047-026-243-217.res.spectrum.com. [47.26.243.217]) by smtp.gmail.com with ESMTPSA id c16-20020ac87d90000000b004054fbf9273sm311286qtd.80.2023.07.21.09.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 09:10:43 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , =?UTF-8?q?Mika=20Penttil=C3=A4?= , Brian Gerst Subject: [PATCH v2 3/6] x86/entry/compat: Combine return value test from syscall handler Date: Fri, 21 Jul 2023 12:10:14 -0400 Message-ID: <20230721161018.50214-4-brgerst@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721161018.50214-1-brgerst@gmail.com> References: <20230721161018.50214-1-brgerst@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Move the sysret32_from_system_call label to remove a duplicate test of the return value from the syscall handler. Signed-off-by: Brian Gerst --- arch/x86/entry/entry_64_compat.S | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 70150298f8bd..b16272395f1a 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S @@ -118,9 +118,6 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL) movq %rsp, %rdi call do_SYSENTER_32 - /* XEN PV guests always use IRET path */ - ALTERNATIVE "testl %eax, %eax; jz swapgs_restore_regs_and_return_to_usermode", \ - "jmp swapgs_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV jmp sysret32_from_system_call .Lsysenter_fix_flags: @@ -212,13 +209,15 @@ SYM_INNER_LABEL(entry_SYSCALL_compat_after_hwframe, SYM_L_GLOBAL) movq %rsp, %rdi call do_fast_syscall_32 + +sysret32_from_system_call: /* XEN PV guests always use IRET path */ ALTERNATIVE "testl %eax, %eax; jz swapgs_restore_regs_and_return_to_usermode", \ "jmp swapgs_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV - /* Opportunistic SYSRET */ -sysret32_from_system_call: /* + * Opportunistic SYSRET + * * We are not going to return to userspace from the trampoline * stack. So let's erase the thread stack right now. */ -- 2.41.0