Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3509820pxb; Wed, 13 Oct 2021 07:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyttlOXusy2zOmXi+r4YBUkIKaHVS6RkYEzdJw4qs/kObFP6/ttYhGJN9a94kTMoGv8A1xm X-Received: by 2002:a17:90a:1a02:: with SMTP id 2mr13936159pjk.6.1634135241854; Wed, 13 Oct 2021 07:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634135241; cv=none; d=google.com; s=arc-20160816; b=tWii9DYzaPUtFPPGQdcpAUw9Y6pqTHhemHwA9sKf6C5+SDuUj1eLs7K2l0eGiTV8uu lCKLQtKnzuwSX3V/QKU1z8cezSiANTp7HK+IcxCqM6sDiIR9XVbdvmBKdZpXNaY2RN5E OI9lbK5GlCPNI3EZErQcLNtYswxAGY+SqI5M3C+jAcB3FkOXzdM3SPYJkZgOmZ/ePkOL mtDr3WtXkR5qayW2R8Z4CcAhDssw6f+cSgWgB9ZsKYTr9jvk+7OE8tgXtHcPnbomuzV4 zKGQym0N4crJqSu4jpQsRLLLc3RkjwRF6eFLKN6bokUT+boLMnYuj+d+m/hKEIeS09Fi xd8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RKM91OnXf+ojmMjBZkqgIIV9z/wOzv1Mq5R6hux0mJE=; b=iwsFaCBUcaMg5jaquBEyhvRakGbIof6U5hdVPWHnc3nHICwV4ADlK9HbAcgWJ08bgT Y9CDXMDcHWvOGnMKUGYt4hXdqQAUh8R10dXp3kBnwoxSqJUsPf24NDX9YV6xzdX8Iqrz Q4UbrUUkaW9ITqsHoDX9fXZmId+/o5uFP8ET/zDsbUAA0Q2DcH7d/IPS/e7oBmbbL6sT ew3M7yGSJjawtWgVAIdOlPh2BOa4YcLK+eEH21g1dw8hCvUFd/9Pu7AR7QqpUkUBfoFD FWJEo6YRtcp118uWMb5H467ECrt4K3TX2umTHkco7iM4druBZZTfMJwMEgbHldWyh4m8 IE2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si19969769pgp.12.2021.10.13.07.27.07; Wed, 13 Oct 2021 07:27:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237128AbhJMO0t (ORCPT + 99 others); Wed, 13 Oct 2021 10:26:49 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:44247 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237322AbhJMO0q (ORCPT ); Wed, 13 Oct 2021 10:26:46 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 19DEOXi9008637; Wed, 13 Oct 2021 16:24:33 +0200 Date: Wed, 13 Oct 2021 16:24:33 +0200 From: Willy Tarreau To: Borislav Petkov Cc: Ammar Faizi , Paul Walmsley , Palmer Dabbelt , Albert Ou , Linux Kernel Mailing List , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Michael Matz Subject: Re: [PATCH] tools/nolibc: x86: Remove `r8`, `r9` and `r10` from the clobber list Message-ID: <20211013142433.GB8557@1wt.eu> References: <20211012222311.578581-1-ammar.faizi@students.amikom.ac.id> <20211013125142.GD5485@1wt.eu> <20211013140723.GE5485@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 04:20:55PM +0200, Borislav Petkov wrote: > On Wed, Oct 13, 2021 at 04:07:23PM +0200, Willy Tarreau wrote: > > Yes I agree with the "potentially" here. If it can potentially be (i.e. > > the kernel is allowed by contract to later change the way it's currently > > done) then we have to save them even if it means lower code efficiency. > > > > If, however, the kernel performs such savings on purpose because it is > > willing to observe a stricter saving than the AMD64 ABI, we can follow > > it but only once it's written down somewhere that it is by contract and > > will not change. > > Right, and Micha noted that such a change to the document can be done. great. > And we're basically doing that registers restoring anyway, in POP_REGS. That's what I based my analysis on when I wanted to verify Ammar's finding. I would tend to think that if we're burning cycles popping plenty of registers it's probably for a reason, maybe at least a good one, which is that it's the only way to make sure we're not leaking internal kernel data! This is not a concern for kernel->kernel nor user->user calls but for user->kernel calls it definitely is one, and I don't think we could relax that series of pop without causing leaks anyway. Willy