Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1127454rdg; Wed, 11 Oct 2023 15:44:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBcFu9c8HBdqfMDKbe5x5SAkfnFdV68O8O7HIreELdiecSEnEf9E0yc4KhdhCKWRMRy6Cw X-Received: by 2002:a17:90a:a018:b0:27d:c2d:94e8 with SMTP id q24-20020a17090aa01800b0027d0c2d94e8mr2580993pjp.28.1697064258142; Wed, 11 Oct 2023 15:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697064258; cv=none; d=google.com; s=arc-20160816; b=rSGF04EZRRx/eIeSR7/YKmOgk5u+Dm760e8gS+ziThS0d/YQiV3B46XwYc6937yqoY 3GvuQDPqSuKsuIlTn0xlSf9Rq+Gpw5EbqLGYXX/OehoCo6+yF4ozGSU2Ju8gkzPI3cdS 9uUtkgoX1aw8jzYTv5xEsHfiEUYSJ0jJPgST/VorUwQGU2h/zq5cFiyWce5bvHPFK72S BAwX0fS8kJPUb5F5Sni+iUgXJwO/C8QgYUArFQkEnfMTItDgMSjUpBVFD+KPlMsv7SR0 shg6og5JF88s0oyChgp/0X43RzHV3hofrMYTg/7+PxW/YxpLnPtdYyY0TnCLnEawnAiO AaMw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=4nQtgf87q9wy+lFMtA87OIvwbhZSyFLG2WJPnwm1IO8=; fh=WGM1QZbt/SlLWUT0E34ZDX9cK40FItT/GbeLHeozOhU=; b=k0w6lQOJGiM+AyP7NVaEAlMt/O80bb0f5ujJ3lyQsqFHUSUZ5ikOfsK1rW6JKB/swd cvWac+BMFMRv/vJBxzziPmB7zNRlPJ2o0msF7Up4LrfdfNVkDLR+L41twe7oucQ1L9Hq 31TuqL6N9AfbyehQQI7EYlHgeas7GNEbjQctanf2bMdLZeXkClFV2BiK09sjTH1oHZxz k6xoTwJohARjK+wgCKDeucIafjV2gzU/YIVDuCFYL/CyyGnnPSkRuV1YyZo2fEm6Ad/O Ka9IBloAPnmMf8luUPCREzX82eJEKGfMr8vjwmwCLjcQsD02f2N58+WfmPETJNhCktWn DIJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XoHmDtQW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id rm6-20020a17090b3ec600b002680e08a877si863098pjb.186.2023.10.11.15.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 15:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XoHmDtQW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E6B128171680; Wed, 11 Oct 2023 15:44:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376537AbjJKWoD (ORCPT + 99 others); Wed, 11 Oct 2023 18:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376394AbjJKWn5 (ORCPT ); Wed, 11 Oct 2023 18:43:57 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3BDA9 for ; Wed, 11 Oct 2023 15:43:55 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3af609c3e74so185678b6e.2 for ; Wed, 11 Oct 2023 15:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697064235; x=1697669035; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4nQtgf87q9wy+lFMtA87OIvwbhZSyFLG2WJPnwm1IO8=; b=XoHmDtQWVAEW9BY/ZjYI0bm/Gv7qZnGU1ykIv/gJ6xMCqJTUikEC8R/SEBWgLFfYqU yxKORaCn+2/I7TqgVE5nLun9BGQtWn1/fDkb6tkuJpyB7ZquaSoB/h5Z1DJokeXOGfk2 Tbg4qm30JURnAqvQSY3FIv9R6EhikTcxZ5jBJSbWCa9eynB1PQpgRUJnvstpWOJhMvCP YdI12L3RUQNuJQ9QJXh1fr31ZqNa+aSd9cVxPcdxqE4ypf53Zje+T1IOYVSeKOLpZAgO bnowMNNHNdCO25dsS2VuioRGubUcDfDsM+rjjldoYWoqPULGjIkRTOGRQlzjy7q7UdtO VdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697064235; x=1697669035; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4nQtgf87q9wy+lFMtA87OIvwbhZSyFLG2WJPnwm1IO8=; b=NGshTD5C9QICSon58p7lTuRgdtnQfPPcbuAuoMscA0KafRRM3k5uMSXj4lTlfYblZw XYPmciLa51XFPw/l6jBSbTMXMQYsFVRbbK7e2ZwbOpY7yKr0CYLToEoq2HPjjM0atfZj 7lR+bWNWTOBeOWzYRLmpvQj7JFYTBnXcdPMwPslVgoebfpWAOw7MpqAJYCK/ZZywUqgb 7a1hHmve6dapSiTK9QSrRzMMnuGNGvn1Lkt3RG/+/k0yxP5Q430uZ/nWPU0vdjI7WteZ qXbGTVkOE2vNcgfu/jeZkBn96gSy1tcCBn305Qw3L8kmunToiG7F0otQQ1m9O9uoqVSw h7/A== X-Gm-Message-State: AOJu0YxzRzQDtwctGd3cVq+A0wN4eQCqGLl8jpPNn32hcN5kgfiSQjr4 /r1DDFhvLVo0HO5QKGrgLqRR36bBBA== X-Received: by 2002:a05:6808:23c4:b0:3a7:5611:a53b with SMTP id bq4-20020a05680823c400b003a75611a53bmr31917381oib.0.1697064234667; Wed, 11 Oct 2023 15:43:54 -0700 (PDT) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id o10-20020a0cf4ca000000b0065b129ec0e8sm6132871qvm.57.2023.10.11.15.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 15:43:54 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Brian Gerst Subject: [PATCH v3 0/3] x86: Clean up fast syscall return validation Date: Wed, 11 Oct 2023 18:43:48 -0400 Message-ID: <20231011224351.130935-1-brgerst@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 15:44:13 -0700 (PDT) X-Spam-Level: ** This patch set cleans up the tests done to determine if a fast syscall return instruction can be used to return to userspace. It converts the code to C, and refactors existing code to be more readable. v3: - Remove patches already applied to -tip. - Keep Xen alternatives on the asm side to skip testing the return value. - Add patch to simplify canonical-RIP test. v2: - Fix shift value for canonical RIP test and use __is_canonical_address() Brian Gerst (3): x86/entry/64: Convert SYSRET validation tests to C x86/entry/64: Use TASK_SIZE_MAX for canonical RIP test x86/entry/32: Clean up syscall fast exit tests arch/x86/entry/common.c | 91 ++++++++++++++++++++++++---------- arch/x86/entry/entry_64.S | 53 +------------------- arch/x86/include/asm/syscall.h | 2 +- 3 files changed, 67 insertions(+), 79 deletions(-) -- 2.41.0