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 X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C93C43461 for ; Thu, 17 Sep 2020 12:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF0412087D for ; Thu, 17 Sep 2020 12:01:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="hAB04Gr0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbgIQMBx (ORCPT ); Thu, 17 Sep 2020 08:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgIQL5p (ORCPT ); Thu, 17 Sep 2020 07:57:45 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30689C06174A; Thu, 17 Sep 2020 04:57:45 -0700 (PDT) Received: from zn.tnic (p200300ec2f1053009faf0a64ea33345c.dip0.t-ipconnect.de [IPv6:2003:ec:2f10:5300:9faf:a64:ea33:345c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B14D71EC0409; Thu, 17 Sep 2020 13:57:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1600343861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=KnBEYj+XMQPVfN01d6ZhpPkXbMTyDk8FrXgj70Nq8ik=; b=hAB04Gr0GFVFRvmoABoDOoMjAMEX7d9BzfUWg8kmrjehlIDmDb/k0BOprboWaBD1kelh02 yNS3cqD7nv+1MXFhmfT6usY1K5jHusJT3YhDnuWXLyh7ckn1xeY/wg4jyiDD6PfAqGkMWP 6R8HZNjN+Cj7CwKsAAvERjzWXS7w76Y= Date: Thu, 17 Sep 2020 13:57:33 +0200 From: Borislav Petkov To: David Laight Cc: Andrew Cooper , Andy Lutomirski , Nick Desaulniers , Andy Lutomirski , Bill Wendling , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , Greg Thelen , John Sperbeck , "# 3.4.x" , clang-built-linux Subject: Re: [PATCH] x86/smap: Fix the smap_save() asm Message-ID: <20200917115733.GH31960@zn.tnic> References: <441AA771-A859-4145-9425-E9D041580FE4@amacapital.net> <7233f4cf-5b1d-0fca-0880-f1cf2e6e765b@citrix.com> <20200916082621.GB2643@zn.tnic> <20200917060432.GA31960@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 10:05:37AM +0000, David Laight wrote: > The 'red-zone' allows leaf function to use stack memory for locals > that is below (ie the wrong side of) the stack pointer. After looking at "Figure 3.3: Stack Frame with Base Pointer" in the x86-64 ABI doc, you're probably right: 0(%rbp) -8(%rbp) ... 0(%rsp) .. red zone -128(%rsp) i.e., rsp-relative addresses with negative offsets are in the red zone. So it looks like the compiler actually knows very well what's going on here and allocates room on the stack for that 0x8(%rsp) slot. Good. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette