Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1308091imm; Tue, 22 May 2018 01:50:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpMLLJPE1NQBSR5Who9v70WWsH/nKf7HjRX4paJ3b9loUMA+v4ZpJ6E+Sh+ORaIySSyGIDC X-Received: by 2002:a17:902:321:: with SMTP id 30-v6mr23737394pld.122.1526979003515; Tue, 22 May 2018 01:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526979003; cv=none; d=google.com; s=arc-20160816; b=I4wd8oanvVIuVfJlzXJnfTQLDPIi5aOV3dOa9BfsPNDNN3byW3iFjvhQCsR+cubve1 ygGq4NaeU9o6xpwwHm0pnfcpMs4pdXPQoDkYOhB90Netf0Y4loMXNK9KGGIXn/dcRNXN YXSCQfgTcSK4r/J4r6885wIXi4aXDu5+BLimJG3Zp9VyJO5pXJKnvTZCwLRi2OvhfmHZ m0SlYo8IXL2Q7kyeozdVUB0aX1X/SYfy8eRkpj4M8OxJvnMBdutyxgnj3UCddzKgIGJ7 t5vZuEeagZwWRxEqNzXKcXM7X/UHuZrjttxts+p0fX6sKOpe9wyY6E2f8vFlaw8Q5/7N OdaA== 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 :references:in-reply-to:reply-to:mime-version:dkim-signature :arc-authentication-results; bh=TRpkiZpvAuAVwJSb05CAPSm8iIDvDLrRktfwLfimwek=; b=hnqdmkVAh9LPED3pRTzy3ffPtB6YeB6s+MRTMTTp1dmreqMmKVn7uh090jDXVvEyRp BlNrBO2cQM9hRXgwxkgzAILs2TbkR/K42K1Q38aPLCE4VmRxGrjnXNQR+Cu3qAWciGqq R46oJCleW67oHbNmZpIgeDncE1+6TUqF6n6JKJjPNa964/e5H7xP8IJQQmpMgWHFGGYy 9XSQbRvqyXMwGCtJcX4VkcUhgjuXjj/iQg5OdvqSCLHPlOObzsIm/uX4Kp8N8PcFRUr2 419gD1+IGCl6B2F5cZkjZ9hgloqIXgXJQ+YC7Xq2xYa74xUZDWKNFN15vJmcW6j+HaVs ubog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mp17WkKf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u68-v6si16196406pfb.42.2018.05.22.01.49.48; Tue, 22 May 2018 01:50:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mp17WkKf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751342AbeEVIti (ORCPT + 99 others); Tue, 22 May 2018 04:49:38 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39169 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751069AbeEVIth (ORCPT ); Tue, 22 May 2018 04:49:37 -0400 Received: by mail-wm0-f67.google.com with SMTP id f8-v6so31265117wmc.4 for ; Tue, 22 May 2018 01:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TRpkiZpvAuAVwJSb05CAPSm8iIDvDLrRktfwLfimwek=; b=Mp17WkKfzOlk9YCwlJwo82V0SwxXyaLVCwNgJCH4rBU4G4LsccB6/upnffKA5U+TwV 9oJT+bzd07VBApoMANQGNa0qks9PvmigexZ9CB9O6sD9uHTmwlz9JDn0KHOaUpKxqMsh jkFESG8e9XOKcwQiEmU+sXe2SXuoM6wbBEwysO41cUVCUkQQj8rOukf+sIpXSx3q2t8K C57ZLT+wZ0KycTeAdn8JMSUxvu81k7fkIld92m+dZdlfIFP/CUCZbmG87UvbqWdQYVFJ gYmHzQ30L/zrfRTLPcEcSBhOPQkK+0cMs49D+6wqSxA6+glX3Ppb/jfQmhW9TAnsrIuQ v0pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=TRpkiZpvAuAVwJSb05CAPSm8iIDvDLrRktfwLfimwek=; b=Kc8VRfncjxalEB/8P8s4+5K/QY/PJ2NZYMZ4Qj6r0P90H6rAZBoBZjMXFj33CqTlsi pDqIrgtkpKj5Sp+XM8GNm9t3u9vGnb4sM9N9NOgqBWcuABsbZZqkM+OFOYwoHcLPbTIx p9osa4egP1jMk2b8p8c/GTYweRjD1uKOHK+hX170UTYd+8H8iSmdfgKYgyAtWeu7gKAb jOtoonU2dLcHAbpUrvW+3PCY4Vqa4/THJ1b3Kxfuy7pA6ioK46Ls2hwLGTXGSAY60fCY +g+g930naCTMwsHdG/QPRWrHnPE80dCfbM+ZXeaEuffiIbt1hLv7EsgI9up+VPdWzSWS 54xg== X-Gm-Message-State: ALKqPwdU4vmPzlHvSHxAidXCclNgZH7tNxnTUU51vCVFrRs6CaGKGwAG 57te01Ov/JGZ6Suc0tk14nGjQb6o20BXZVnsMYA= X-Received: by 2002:a2e:7a0c:: with SMTP id v12-v6mr13778997ljc.79.1526978975699; Tue, 22 May 2018 01:49:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:ce89:0:0:0:0:0 with HTTP; Tue, 22 May 2018 01:49:35 -0700 (PDT) Reply-To: sedat.dilek@gmail.com In-Reply-To: References: <20180423174224.GA243180@google.com> <20180424230645.GB243180@google.com> <20180507174909.GF19594@google.com> From: Sedat Dilek Date: Tue, 22 May 2018 10:49:35 +0200 Message-ID: Subject: Re: Clang patch stacks for LTS kernels (v4.4 and v4.9) and status update To: Nick Desaulniers Cc: Matthias Kaehlcke , lkml , Arnd Bergmann , Manoj Gupta , AlistairStrachan , "Steven Rostedt (VMware)" 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 On Tue, May 22, 2018 at 10:04 AM, Sedat Dilek wrote: > On Tue, May 22, 2018 at 9:39 AM, Sedat Dilek wrote: >> On Sat, May 19, 2018 at 12:54 AM, Nick Desaulniers >> wrote: >>> Sedat, >>> Thanks for the report. We have a fix ready in >>> https://bugs.llvm.org/show_bug.cgi?id=37512. Can you report what >>> version of clang you were using and if earlier versions of clang have >>> this issue? >>> Thanks, >> >> Can you give some advices on how to implement >> "attribute((no_stack_protector))" for Clang? >> >> I looked on how this is done for GCC... >> >> [ include/linux/compiler-gcc.h ] >> >> #if GCC_VERSION >= 40400 >> #define __optimize(level) __attribute__((__optimize__(level))) >> #define __nostackprotector __optimize("no-stack-protector") >> #endif /* GCC_VERSION >= 40400 */ >> >> [ include/linux/compiler_types.h ] >> >> #ifndef __nostackprotector >> # define __nostackprotector >> #endif >> >> LLVM-bug #37512 says: >> >> "GCC option for this is: attribute((optimize("no-stack-protector"))) >> and the equivalent clang syntax would be: attribute((no_stack_protector))" >> >> So, there should be a define in "include/linux/compiler-clang.h" for this? >> >> [ include/linux/compiler-clang.h ] >> >> #define __nostackprotector attribute((no_stack_protector)) >> >> Looks that good to you? >> > > I am trying with the attached files and... > > CONFIG_PARAVIRT=y > CONFIG_CC_STACKPROTECTOR_STRONG=y > Hmmm, I get these errors in my build-log... mycompiler -Wp,-MD,arch/x86/kernel/.asm-offsets.s.d -nostdinc -isystem /usr/lib/llvm-7/lib/clang/7.0.0/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Qunused-arguments -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mstack-alignment=8 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mretpoline-external-thunk -DRETPOLINE -O2 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-address-of-packed-member -Wno-tautological-compare -mno-global-merge -no-integrated-as -g -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-unused-value -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized -DKBUILD_BASENAME='"asm_offsets"' -DKBUILD_MODNAME='"asm_offsets"' -fverbose-asm -S -o arch/x86/kernel/asm-offsets.s arch/x86/kernel/asm-offsets.c In file included from arch/x86/kernel/asm-offsets.c:9: In file included from ./include/linux/crypto.h:24: In file included from ./include/linux/slab.h:15: In file included from ./include/linux/gfp.h:6: In file included from ./include/linux/mmzone.h:8: In file included from ./include/linux/spinlock.h:51: In file included from ./include/linux/preempt.h:81: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from ./include/linux/thread_info.h:38: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: In file included from ./arch/x86/include/asm/processor.h:33: In file included from ./include/linux/irqflags.h:16: ./arch/x86/include/asm/irqflags.h:16:29: warning: declaration specifier missing, defaulting to 'int' static inline unsigned long __nostackprotector native_save_fl(void) ^ ./include/linux/compiler-clang.h:28:39: note: expanded from macro '__nostackprotector' #define __nostackprotector attribute((no_stack_protector)) ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from ./include/linux/crypto.h:24: In file included from ./include/linux/slab.h:15: In file included from ./include/linux/gfp.h:6: In file included from ./include/linux/mmzone.h:8: In file included from ./include/linux/spinlock.h:51: In file included from ./include/linux/preempt.h:81: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from ./include/linux/thread_info.h:38: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: In file included from ./arch/x86/include/asm/processor.h:33: In file included from ./include/linux/irqflags.h:16: ./arch/x86/include/asm/irqflags.h:16:48: error: expected function body after function declarator static inline unsigned long __nostackprotector native_save_fl(void) ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from ./include/linux/crypto.h:24: In file included from ./include/linux/slab.h:15: In file included from ./include/linux/gfp.h:6: In file included from ./include/linux/mmzone.h:8: In file included from ./include/linux/spinlock.h:51: In file included from ./include/linux/preempt.h:81: In file included from ./arch/x86/include/asm/preempt.h:7: In file included from ./include/linux/thread_info.h:38: In file included from ./arch/x86/include/asm/thread_info.h:53: In file included from ./arch/x86/include/asm/cpufeature.h:5: ./arch/x86/include/asm/processor.h:76:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lli_4k[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:77:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lli_2m[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:78:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lli_4m[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:79:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lld_4k[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:80:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lld_2m[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:81:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lld_4m[NR_INFO]; ^ ./arch/x86/include/asm/processor.h:82:37: error: use of undeclared identifier 'NR_INFO' extern u16 __read_mostly tlb_lld_1g[NR_INFO]; ^ 1 warning and 8 errors generated. Kbuild:57: recipe for target 'arch/x86/kernel/asm-offsets.s' failed make[3]: *** [arch/x86/kernel/asm-offsets.s] Error 1 Makefile:1085: recipe for target 'prepare0' failed make[2]: *** [prepare0] Error 2 scripts/package/Makefile:91: recipe for target 'bindeb-pkg' failed make[1]: *** [bindeb-pkg] Error 2 Makefile:1367: recipe for target 'bindeb-pkg' failed make: *** [bindeb-pkg] Error 2 - Sedat -