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=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,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 4026CCA9EA0 for ; Fri, 18 Oct 2019 16:58:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A31D2089C for ; Fri, 18 Oct 2019 16:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502168AbfJRQ6T (ORCPT ); Fri, 18 Oct 2019 12:58:19 -0400 Received: from smtprelay0160.hostedemail.com ([216.40.44.160]:42320 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405642AbfJRQ6T (ORCPT ); Fri, 18 Oct 2019 12:58:19 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 9DF0745B3; Fri, 18 Oct 2019 16:58:17 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: fruit53_8252359efdc20 X-Filterd-Recvd-Size: 2322 Received: from XPS-9350.home (unknown [47.151.135.224]) (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA; Fri, 18 Oct 2019 16:58:15 +0000 (UTC) Message-ID: <8268ba22cccae0dccf5a8d1902bc1409877fbd4e.camel@perches.com> Subject: Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS) From: Joe Perches To: Sami Tolvanen , Will Deacon , Catalin Marinas , Steven Rostedt , Ard Biesheuvel Cc: Dave Martin , Kees Cook , Laura Abbott , Mark Rutland , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Fri, 18 Oct 2019 09:58:14 -0700 In-Reply-To: <20191018161033.261971-7-samitolvanen@google.com> References: <20191018161033.261971-1-samitolvanen@google.com> <20191018161033.261971-7-samitolvanen@google.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.32.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-10-18 at 09:10 -0700, Sami Tolvanen wrote: > This change adds generic support for Clang's Shadow Call Stack, which > uses a shadow stack to protect return addresses from being overwritten > by an attacker [] > .diff --git 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"))) trivia: This should likely use the __ prefix and suffix form: #define __noscs __attribute__((__no_sanitize__("shadow-call-stack"))) as should the __no_sanitize_address above this > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h [] > @@ -202,6 +202,10 @@ struct ftrace_likely_data { > # define randomized_struct_fields_end > #endif > > +#ifndef __noscs > +# define __noscs > +#endif > + > #ifndef asm_volatile_goto > #define asm_volatile_goto(x...) asm goto(x) > #endif