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.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 C4753CA9EA9 for ; Fri, 18 Oct 2019 20:33:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D6172054F for ; Fri, 18 Oct 2019 20:33:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jlhYl/cm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="KQhoMvQg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D6172054F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rqNd/kxu3Saw7eQyh46iJbV9j5M9SJT/DsUMy2HrMQY=; b=jlhYl/cmIzre9X HJnKwc8WvFKJhEnzlmtZoEMYU3/bleOh9Fj/8Tid6gF25h8Ox8+X0fB7wuudkysOQCu2Lp5jX8feg /o/3UL4QTtp3LD2mkOnUYeFrolG845O2M8nB41EMYVp1qHd8HsHWRnpvAOu5LzPJ6GMuf5JP8ac3k 7lL8QVG4qx9QqbkNPOzoebQhwjfZj2KOCtQmLcNkVvCIh9c+LfvYi5DJjN1X9HwKtyXIA0Lpnrc/1 jOenv4akhJfKxekOJRm4JS7JoHdgEaWnQBZ8YKKRjrWUH8xGeVnAoYgKsrKAczB3RCeX5E/vOG+OM HojXq6uYTGbtuqHNQNMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLYwR-0001pl-Ga; Fri, 18 Oct 2019 20:33:43 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLYwO-0001pC-9l for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2019 20:33:41 +0000 Received: by mail-pl1-x643.google.com with SMTP id q24so3372254plr.13 for ; Fri, 18 Oct 2019 13:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s5h/GhSdlUicoMowUqjyBoWS/+duNMzdyCGodDdcTtc=; b=KQhoMvQgSY1S7JFuJAFTC9HRZeQ5mdpO9TvuIKoj0v5SvnSQNuvf8amINPFUPzI8nY 7ZIM6uhg5mZL7guVvq0mSjr6gr+NtNERf4pjkYKL/atuXVKYh6ehfKZIXGRfpXFMwBUC ThYtEebG3W5YCny4jaBcl/Q0epyHh1RHZdFHsBm9kE9ybU6tBqxynDXHqthx+xaibjMa 95n/a/SX8ULgLGxFbhmjkRP3CjI5ClIpGsJpW9IT2pdvvEpsvlxPiNChvpjefs0l29Vq fQGmX4cDpEBIZ/Jt5jFZrqKpbzygKQM8pdWXq7Ks30lBud8WR8HSBUqDptTm7GHM8fiq R4uQ== 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=s5h/GhSdlUicoMowUqjyBoWS/+duNMzdyCGodDdcTtc=; b=TNF9fpyYl3TjNUMKzp0jAogjOLvgDgV2jejad2Us31ojw8MqNfeY1I55+WEtd/ePSW JQuwjpuImf9qYbaO4gIajcuseDP7leOOvkNpSySu3Cr4bJ/hSz/+HQZXYdOyew4siAhB c1hyaqZd5fvWfrPL7Za4c8RelsT4pEgpLxX8nKzErbHK4Pc1dTpa8RSC7rO9waKQ9923 Td6DvKVXzEEn5NIbtqFJsIxr9M2KYc4xz881boB5cHL+oNTzEUMhfTrEUZL2VQahM2M5 6jFB0kcPuiFQAQ3oNFMpGG4OZtRqfkYi6pFmOg1wNztz7wUL5FpMYiGwYEJLyG36IN2d BVuA== X-Gm-Message-State: APjAAAV4GPqyATU+0IKCa6kI/E5FVgNZO/sWIKFbRVb2WCQzYNtAuXzV DJxI5NxmRgBh6ybtQrLrCmtFTKd2uAg4WVAbMsc+2w== X-Google-Smtp-Source: APXvYqyNa4FKOObSpxuU4QFrkn4kv2RtplqwVoFiBNyGX9dC4x3R93/WFE745QDJwjnJLdnYdKd+pE8O7U/JRiSJhZU= X-Received: by 2002:a17:902:9b83:: with SMTP id y3mr11637082plp.179.1571430819228; Fri, 18 Oct 2019 13:33:39 -0700 (PDT) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20191018161033.261971-7-samitolvanen@google.com> In-Reply-To: From: Nick Desaulniers Date: Fri, 18 Oct 2019 13:33:27 -0700 Message-ID: Subject: Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS) To: Miguel Ojeda X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191018_133340_366850_7C2BB37A X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Ard Biesheuvel , Catalin Marinas , Kernel Hardening , LKML , Steven Rostedt , clang-built-linux , Sami Tolvanen , Laura Abbott , Will Deacon , Dave Martin , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 18, 2019 at 11:33 AM Miguel Ojeda wrote: > > On Fri, Oct 18, 2019 at 7:11 PM Sami Tolvanen wrote: > > > > On Fri, Oct 18, 2019 at 10:08 AM 'Nick Desaulniers' via Clang Built > > Linux wrote: > > > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > > > > index 333a6695a918..9af08391f205 100644 > > > > --- a/include/linux/compiler-clang.h > > > > +++ b/include/linux/compiler-clang.h > > > > @@ -42,3 +42,5 @@ > > > > * compilers, like ICC. > > > > */ > > > > #define barrier() __asm__ __volatile__("" : : : "memory") > > > > + > > > > +#define __noscs __attribute__((no_sanitize("shadow-call-stack"))) > > > > > > It looks like this attribute, (and thus a requirement to use this > > > feature), didn't exist until Clang 7.0: https://godbolt.org/z/p9u1we > > > (as noted above) > > > > > > I think it's better to put __noscs behind a __has_attribute guard in > > > include/linux/compiler_attributes.h. Otherwise, what will happen when > > > Clang 6.0 sees __noscs, for example? (-Wunknown-sanitizers will > > > happen). > > > > Good point, I'll fix this in v2. Thanks. > > +1, please CC whenever you send it! Sami pointed out to me off thread that __has_attribute would only check `no_sanitize`, not `shadow-call-stack`. So maybe best to keep the definition here (include/linux/compiler-clang.h), but wrapped in a `__has_feature` check so that Clang 6.0 doesn't start complaining. -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel