Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3014952pxb; Sat, 23 Oct 2021 13:43:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjoCqUiSR/jNE8BjTLqxwO6rSNjVqtwOGTPNFScyHGArwrIq/O+6jEWMoyaU4JMPO3ZxwY X-Received: by 2002:a05:6a00:2351:b0:47b:d092:d2e4 with SMTP id j17-20020a056a00235100b0047bd092d2e4mr5791594pfj.76.1635021793813; Sat, 23 Oct 2021 13:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635021793; cv=none; d=google.com; s=arc-20160816; b=EtWC3IiaB+yjscY52Z6i7aJd4Lre/DDJE5cKIKOhsR5aG4RxOn5yfLxG8CeQTKCNqb /sG0W1ygFmLSKjNFL5PT/nV1Vw3ee8QVCXPVTNnyTPMMY9jGE9fwCF54evNRFBUgnyQO Ao3Hd4ciXq8DAfqznaqICNSpABs9xXeng93Hpk98h8DA7P6wyo7E4wcF4dWGfQG2+mBx FzoFFK19xRfLATf2ldjV0IwP09LdO1MMumX9oqzuz8Rz+BSn3hmhSy8oOiH3pAP4DUJx uvwRogpcb3yfRmT/EC/zI9I5XmEs7bALCFpcm9dNB49ZmcLRE6tVDjwFywXbsdmc5tpD /5lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=M08KcBBnZ5xmty6COK1mkhbDyM7w0Gb9jHjSINaeOAM=; b=Uo61DNFZZ88AIfHlb+Db8d6FyZLJ2MBJG/W9yD9h8VeqK0FjEFgySfgH7nj1ToeQDN mz9dLrwFkcZ7WSKqTmdhJKWVz7+ceSiQWmjIWC2kGolLbryGAiD9m6FUyEvwyUcg1MmT TX9/bgKe9Qrzwi487XpwqP+YL6NKdVc7GV36S2/b0ECbuNQ7x12iGwRFXZ7Ge+L8wklg NbDkpKppONtl69zDUPZvoiT+667FKmk6HkoY7yFHxg40UrrIRqRk3b3iLwbZwU5RHRGb iSoVKnY78XllUIxhfzn/L7XOPCb5RXbjM1lrqq+MzjiRv/4fzHZ8Od0jSSgrpRKr8bws oS4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021093001 header.b=dZvMZMmV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si22243483pga.82.2021.10.23.13.43.00; Sat, 23 Oct 2021 13:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2021093001 header.b=dZvMZMmV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbhJWUoZ (ORCPT + 99 others); Sat, 23 Oct 2021 16:44:25 -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