From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2965DC433F5 for ; Sat, 23 Oct 2021 20:42:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 110206058D for ; Sat, 23 Oct 2021 20:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbhJWUo0 (ORCPT ); Sat, 23 Oct 2021 16:44:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:55769 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbhJWUoY (ORCPT ); Sat, 23 Oct 2021 16:44:24 -0400 Received: from [IPV6:2601:646:8600:40c0:7285:c2ff:fefb:fd4] ([IPv6:2601:646:8600:40c0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 19NKf4Af2291380 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sat, 23 Oct 2021 13:41:08 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 19NKf4Af2291380 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021093001; t=1635021673; bh=M08KcBBnZ5xmty6COK1mkhbDyM7w0Gb9jHjSINaeOAM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dZvMZMmVpSQ9jOXTcsOi5gUFL9hjNHLSmAoNQ3x8SN5O86573QYFUEzpH1ea1ZJ/Z blrK7hKNDJnr3qlR/LmLKLpYj9roSJqJ2yQGn07/bMYGKqEtKYaBFqVrVpM248ou2W 3s+i9sgrKMVQ5st9QtD0ZHdn+PqIZ1gZyR73ZBWDdT4mfVCJbpjDrfmNOk0wN5yZBB x84V9ypM8XVZUlLwsvQMPMn/rt+dWDw+dKLL83A68pweWNBfirVY7sOf8kQm68oTnD 6pidgTdvsNqMopXkk8eJq2wTAyz5FE/4kbY1kuFNLImrOnvhA1UpUI/uIa/Ln+ehh/ ufrHcw//Dx/Cg== Message-ID: <8147f571-0da2-f20c-31dd-72ad56eb1ba0@zytor.com> Date: Sat, 23 Oct 2021 13:40:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] tools/nolibc: x86: Remove `r8`, `r9` and `r10` from the clobber list Content-Language: en-US To: Borislav Petkov , Ammar Faizi Cc: Willy Tarreau , Paul Walmsley , Palmer Dabbelt , Albert Ou , Linux Kernel Mailing List , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , x86@kernel.org References: <20211012222311.578581-1-ammar.faizi@students.amikom.ac.id> From: "H. Peter Anvin" In-Reply-To: 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 10/13/21 05:43, Borislav Petkov wrote: > On Wed, Oct 13, 2021 at 05:23:11AM +0700, Ammar Faizi wrote: >> "Figure 3.4: Register Usage" is not the answer, if it were, nolibc.h >> would be broken as it is missing "rdi", "rsi", "rdx" in the clobber list. > > It is not about what happens in practice but what the contract is: > syscall argument registers can potentially get clobbered and userspace > should treat them as such. Because if the kernel decides to actually > clobber them for whatever reason and some userspace thing thinks > otherwise, then it is the userspace thing's problem as it doesn't adhere > to the well known ABI. > Currently the kernel doesn't, but some past kernels have zeroed some of these registers rather than preserving them. -hpa