Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1521377ybg; Thu, 4 Jun 2020 11:47:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnNlRmT+H7LXRfqwDDelEcX7FjJWzJXe8tdHAnlYMIl+czScd9ixKqhwLw8qJ8OtK+0fVC X-Received: by 2002:a17:907:b15:: with SMTP id h21mr5200711ejl.450.1591296427910; Thu, 04 Jun 2020 11:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591296427; cv=none; d=google.com; s=arc-20160816; b=lD1vHUQeNp27hPymGTyAH2Cq59zhCDK6I8CKrJAruVo3n4DUT+otb92hc+D1LooHHp gf58tLkU0fGW1VVu9hTNjhVxEcl0tKf3ef95A2KqW0pGXvTodaN7ntXjprv02c9kIfmn HuXXJbPkXOM9ENYOnLGohX9/I18uCOPu6MriqHCPAUG0/V9AReErH1QrlmzjR5mUnGTn tS4GytIm4Arj4bWh+V4iQxSoi4qCEk7TI/0QgnWgMpzh/31NII2JvKdBDXnWWOD1F0NO FcVmAxX2MQY6yIY3x2+K2744jNwxMpCCmW3gNBWrdihvjJ5vuq7Zu8vbqA6+MWJLvdII SJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=R+rSrnYLVqsdod0ox2SKtnqs+7zx/Hz4GLO8xy+04nE=; b=jkBnXbvGZfH5D1TlYqsrpPPOPdMtmvMpojEOT5HaZselPpV8eFtyRmEKVq8KlOnRHz irolisH8cbhuVQSH2gnNd1k59I2tpS4nDqbVqC8nlkWzq0vt8slUFtfvbvWMYa/2R5po zCtaIzPrISKSdA89alK7lU3RkiQbjxUAFnJQYbccAacS5eeljc+TeUAg+r+wZnLvq4/P QmeOcy3F0mxyKB/chYmGXAAypwfi8VdC++L6L9RPxYt0M5mbGZfPa5GVfCsE052MUkNo /vF5LL/6lpLKZfRfBhbs3pL5VNap+OKpDaNias1iKZigyYeD9S1hWFx2Ea8nFQWo8RKE JfaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tiAiD1Bq; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si2016545ejb.670.2020.06.04.11.46.44; Thu, 04 Jun 2020 11:47:07 -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=@gmail.com header.s=20161025 header.b=tiAiD1Bq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729303AbgFDPF7 (ORCPT + 99 others); Thu, 4 Jun 2020 11:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728638AbgFDPF7 (ORCPT ); Thu, 4 Jun 2020 11:05:59 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0387EC08C5C0; Thu, 4 Jun 2020 08:05:59 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id s1so7754701ljo.0; Thu, 04 Jun 2020 08:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R+rSrnYLVqsdod0ox2SKtnqs+7zx/Hz4GLO8xy+04nE=; b=tiAiD1BqLUtW8rAX1B3Txst9ck1bpANIDb6532CrOzxa8+SYqcQVzMWUIrIqHwfkFH PHnApukstTsgqnDgvZmZZF7f0AkvM5cutsl0XcGi2Pbymm48rAjoDeqUP0rQJufNbjNV U1DTwg8QQcTfmMvRFRaIc/PUvQCShSldTL5qsURtgnTw2mS3pb1YcCtRkFDi9qkdBmbs +w3hI2IMbAuFHS2rWaC6Am5XmtU2osSFlJTcvkeFDjXW3t+Mc804R2xEZJmK3Bg3lazk j1hTv/fbOlKG+IG25Puo8o29RBHnfgg8yktHPNROZW7UkPsslMdeaXUYMod2IAvkYUMH NIhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R+rSrnYLVqsdod0ox2SKtnqs+7zx/Hz4GLO8xy+04nE=; b=m+OfOsBV4xpQqeyUBg7N11YS2F7QrhVHr5OB3bnKlJEbeQ22v7+OwLJy5wcN3LTpfP /1Ezz73rz/cKMCrG9kXFJC83rELzPUrcKjPhsRcIZ3uWMP52OeGt+00A2CNBMjpV07UT RyC/mFFAw6YCQ1r67xs8maUDO3+/7ycUDE9PEYlkTvPRvKpS0b3o3KDyqJ4COTwNEXk3 2jLRc8voQk6qh0Yh0Bc4L+K9N0B+lWW7Bwb/SAZ4Wu9A7w0WrjiABjd0xL7WQQKyCXg8 rZ5n12Q3BXbBuYy8Vwg21DYxaHNtHWB//q/uqIhTUUGWJiwD37ejAn8CU8qyRP0+aaAu rYTA== X-Gm-Message-State: AOAM530JzP4UPr3wuf7AueAU6I14PfWgdJ5bj3dFG7oGFSPt17cRnqlt oo6Hdpcrg6kuiJjb3exEsyVX2CVz5hd5uXIWRWs= X-Received: by 2002:a05:651c:11c7:: with SMTP id z7mr2534360ljo.29.1591283157446; Thu, 04 Jun 2020 08:05:57 -0700 (PDT) MIME-Version: 1.0 References: <20200604134957.505389-1-alex.popov@linux.com> <20200604134957.505389-3-alex.popov@linux.com> In-Reply-To: <20200604134957.505389-3-alex.popov@linux.com> From: Miguel Ojeda Date: Thu, 4 Jun 2020 17:05:46 +0200 Message-ID: Subject: Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving To: Alexander Popov Cc: Kees Cook , Emese Revfy , Masahiro Yamada , Michal Marek , Andrew Morton , Masahiro Yamada , Thiago Jung Bauermann , Luis Chamberlain , Jessica Yu , Sven Schnelle , Iurii Zaikin , Catalin Marinas , Will Deacon , Vincenzo Frascino , Thomas Gleixner , Peter Collingbourne , Naohiro Aota , Alexander Monakov , Mathias Krause , PaX Team , Brad Spengler , Laura Abbott , Florian Weimer , Kernel Hardening , Linux Kbuild mailing list , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Linux ARM , linux-kernel , gcc@gcc.gnu.org, notify@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexander, On Thu, Jun 4, 2020 at 3:50 PM Alexander Popov wrote: > > diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h > index cdf016596659..522d57ae8532 100644 > --- a/include/linux/compiler_attributes.h > +++ b/include/linux/compiler_attributes.h > @@ -41,6 +41,7 @@ > # define __GCC4_has_attribute___nonstring__ 0 > # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) > # define __GCC4_has_attribute___fallthrough__ 0 > +# define __GCC4_has_attribute___no_caller_saved_registers__ 0 > #endif Nit: if you do another version, please move it before `noclone` to keep the order (`fallthrough` was added in the wrong place). Otherwise don't worry, I will sort it together with `fallthrough` when I send a patch. > +/* > + * Optional: only supported since gcc >= 7 > + * > + * gcc: https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#index-no_005fcaller_005fsaved_005fregisters-function-attribute_002c-x86 > + * clang: https://clang.llvm.org/docs/AttributeReference.html#no-caller-saved-registers > + */ > +#if __has_attribute(__no_caller_saved_registers__) > +# define __no_caller_saved_registers __attribute__((__no_caller_saved_registers__)) > +#else > +# define __no_caller_saved_registers > +#endif Ditto. Acked-by: Miguel Ojeda Cheers, Miguel