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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 182F8C46470 for ; Mon, 6 May 2019 15:36:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E42BF205ED for ; Mon, 6 May 2019 15:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbfEFPg0 (ORCPT ); Mon, 6 May 2019 11:36:26 -0400 Received: from relay.sw.ru ([185.231.240.75]:36242 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfEFPgZ (ORCPT ); Mon, 6 May 2019 11:36:25 -0400 Received: from [172.16.25.12] by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hNff9-0004Zp-Q9; Mon, 06 May 2019 18:36:19 +0300 Subject: Re: [PATCH 4.9 09/62] kasan: turn on -fsanitize-address-use-after-scope To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , Andrew Morton , Linus Torvalds References: <20190506143051.102535767@linuxfoundation.org> <20190506143051.888762392@linuxfoundation.org> <6636d7cf-03fe-e253-f981-e07d75858b33@virtuozzo.com> <20190506151026.GA12193@kroah.com> From: Andrey Ryabinin Message-ID: Date: Mon, 6 May 2019 18:36:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190506151026.GA12193@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/6/19 6:10 PM, Greg Kroah-Hartman wrote: > On Mon, May 06, 2019 at 05:55:54PM +0300, Andrey Ryabinin wrote: >> >> >> On 5/6/19 5:32 PM, Greg Kroah-Hartman wrote: >>> From: Andrey Ryabinin >>> >>> commit c5caf21ab0cf884ef15b25af234f620e4a233139 upstream. >>> >>> In the upcoming gcc7 release, the -fsanitize=kernel-address option at >>> first implied new -fsanitize-address-use-after-scope option. This would >>> cause link errors on older kernels because they don't have two new >>> functions required for use-after-scope support. Therefore, gcc7 changed >>> default to -fno-sanitize-address-use-after-scope. >>> >>> Now the kernel has everything required for that feature since commit >>> 828347f8f9a5 ("kasan: support use-after-scope detection"). So, to make it >>> work, we just have to enable use-after-scope in CFLAGS. >>> >>> Link: http://lkml.kernel.org/r/1481207977-28654-1-git-send-email-aryabinin@virtuozzo.com >>> Signed-off-by: Andrey Ryabinin >>> Acked-by: Dmitry Vyukov >>> Cc: Alexander Potapenko >>> Cc: Andrey Konovalov >>> Signed-off-by: Andrew Morton >>> Signed-off-by: Linus Torvalds >>> Signed-off-by: Andrey Konovalov >>> Signed-off-by: Greg Kroah-Hartman >>> >>> --- >>> scripts/Makefile.kasan | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> --- a/scripts/Makefile.kasan >>> +++ b/scripts/Makefile.kasan >>> @@ -29,6 +29,8 @@ else >>> endif >>> endif >>> >>> +CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope) >>> + >>> CFLAGS_KASAN_NOSANITIZE := -fno-builtin >>> >>> endif >>> >>> >> >> This shouldn't be in the -stable. > > Why not? Does no one use gcc7 with this kernel and kasan? > You don't need this patch to use kasan on this kernel with gcc7. This patch only enables detection of use-after-scope bugs. This feature appeared to be useless, hence it disabled recently by commit 7771bdbbfd3d ("kasan: remove use after scope bugs detection.") The link errors mentioned in changelog was the problem only for some period of time in the development branch of GCC 7. The released GCC7 version doesn't have this problem.