Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A55EFC25B4E for ; Tue, 24 Jan 2023 06:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232951AbjAXGSy (ORCPT ); Tue, 24 Jan 2023 01:18:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjAXGSp (ORCPT ); Tue, 24 Jan 2023 01:18:45 -0500 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC4130E98; Mon, 23 Jan 2023 22:18:41 -0800 (PST) Received: from [IPV6:2601:646:8600:40c0:425:cd56:6750:e1bf] ([IPv6:2601:646:8600:40c0:425:cd56:6750:e1bf]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 30O6G6Kk2637243 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 23 Jan 2023 22:16:07 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 30O6G6Kk2637243 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2023010601; t=1674540968; bh=XH58Wca77uh7IXdxF4TdaMGV0Z0CqzpSfbHHO9L64g8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ll9wKs6zudIiHj1aifzzdajB6Af6+Zw6Z2OzuCT0o4621+OBeOdD3DgaGj2K5rWEG lozu0JsZF4T4vcZ6ONJdBsIUbzU+z0PQuLlmSW41wc7zLSpRIsQp7mowKXJrb14drQ /4ChkFGcHsGJTY6HQtSS4fNdGuc+vcnvarZMP3HHfE+sB16qHyKgmCSaXosmwOdFdD 02AL7ipXOwLsECVWCHvjFTcFfmoAKGgqXp2YrmYspmIoOUx9pIH1upWYZJDGCzXCPL v25bsfD1uhXzbFc/bVG94tysGJtodmt9l71iDZ53/vfjDD3w/neoMaGtqwybAfGC2X jnS1yHQ+eP6Qg== Message-ID: Date: Mon, 23 Jan 2023 22:16:01 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RFC PATCH v2 2/2] selftests/x86: sysret_rip: Add more syscall tests with respect to `%rcx` and `%r11` To: Ammar Faizi , x86 Mailing List Cc: Dave Hansen , Dave Hansen , Xin Li , Thomas Gleixner , Andrew Cooper , Brian Gerst , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Shuah Khan , Ingo Molnar , Andy Lutomirski , "Kirill A. Shutemov" , Linux Kselftest Mailing List , Linux Kernel Mailing List References: <5d4ad3e3-034f-c7da-d141-9c001c2343af@intel.com> <18B5DB6D-AEBD-4A67-A7B3-CE64940819B7@zytor.com> <25b96960-a07e-a952-5c23-786b55054126@zytor.com> <6cd0db14-c9e2-3598-fd10-4b473d78c373@citrix.com> <5ecc383c-621b-57d9-7f6d-d63496fca3b3@zytor.com> <20230124022729.596997-1-ammarfaizi2@gnuweeb.org> <20230124022729.596997-3-ammarfaizi2@gnuweeb.org> Content-Language: en-US From: "H. Peter Anvin" In-Reply-To: <20230124022729.596997-3-ammarfaizi2@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/23/23 18:27, Ammar Faizi wrote: > From: Ammar Faizi > > Test that: > > - "syscall" in a FRED system doesn't clobber %rcx and %r11. > - "syscall" in a non-FRED system sets %rcx=%rip and %r11=%rflags. > > Test them out with a trivial system call like __NR_getppid and friends > which are extremely likely to return with SYSRET on an IDT system; check > that it returns a nonnegative value and then save the result. > "Nonnegative" here should be "valid"; it is an implementation detail that the error value is -1. However, you are not checking that you don't get a mix of REGS_SAVED and REGS_SYSRET, which is a major part of the point. -hpa