Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp498057ybm; Thu, 28 May 2020 08:04:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0A0cPbvT7pswNm2hT7wQmBXPRI6pQs75S6nMdY8drdLj1agUbeJ62bCacrvSavkTkDGRK X-Received: by 2002:a17:906:af62:: with SMTP id os2mr3381858ejb.345.1590678296796; Thu, 28 May 2020 08:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590678296; cv=none; d=google.com; s=arc-20160816; b=Rj4XHvsGxLzW1JmTmg3zMi5uzXQATYuaepai1zlN+yBXYrso3UGgIZnV+rzVNzqgpp zXA5r8qezJzgXKuu6y+SYhpJAa4s5i4xKi9PJ0UglxLyRGuFBoihdbSnGGvLiU69nEjL KkPnqQ5kJQUX4iHq69MT7m5pvEzm4lYyAZ+wCKSZ84/gGvUzxiftS9AV1WyzXYbJRiKF XVXbHm6Zo2UNs4ARK0Nt5FgAiuRJxLXDhRHsgPRtORXKw5BZ851wgq5nfNw5IyGzprfB U7np9OBiutCMf0oOkTa5f/z/7ms63U+H50EFVJi3fKANTXEMDz+z5VSq35pGoSRKr3SN lW2Q== 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=k4gasz7E8Vka0VphamQPgsMwOl6rPaC5hW405KW6cAI=; b=Dqfoz8RT++KOAvckRPqEYA7PCw7oGDZEc3+cE6+eacT2zHNm+WcTfRs37uCYhtWSR2 rS6IE0L/aGDFKE7r+3BXqaOhzTzSpnTQe3CfcG8phyaWxE8MAXH7JIkaquuVviLrNoTF KE4H+0HqXEbq6g/i11q2HxTGF6aUE/rviM56s20BDE7Rfz/4R9HrXsFpZnRMCIh3xCGy FlNxvj2T19t2RMKZ4rOXGxIVaN9CKwCYiFzXjcBRv++bW87QmewKeWK9bjDB2eEODPGa aiG8mpOqeuBkkTR17ItaHd7VSJb7IwIHST1UWx7D/gBUQuBc5w/ehetNznGZPq31JCKe kKww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OYx1azbF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si4102789ejb.364.2020.05.28.08.04.29; Thu, 28 May 2020 08:04:56 -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=@google.com header.s=20161025 header.b=OYx1azbF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404113AbgE1PBK (ORCPT + 99 others); Thu, 28 May 2020 11:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403869AbgE1PBG (ORCPT ); Thu, 28 May 2020 11:01:06 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3E20C08C5C6 for ; Thu, 28 May 2020 08:01:06 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id 5so3224717pjd.0 for ; Thu, 28 May 2020 08:01:06 -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=k4gasz7E8Vka0VphamQPgsMwOl6rPaC5hW405KW6cAI=; b=OYx1azbF4P0dfQ10iSb9La9p4gAK2jIv1Jyus2X+j/g6v3DL392OEZJCMm6Gubuxt8 9B93plARWlCI4yChxjLUa6wtP8iFtPYo3Fob5WH+3DD/hZZ9IN4v13ZXa8Njy19M3w90 5xh6LsJfF8CqhmZueR/sIIgcudTwgCdX8SmdLF3zNwLUL58j2SX4AwlRAC+RzF7Wn5V4 /RdBd83tXL/sKKUzTvL1MHStduUDIOEFxz8tqTe0GX2paOOzPf/ekGvWJgzgtTyuIRvc 1DQfX6vwtJnkDRl39I7N9HAa5GqPluQfoDlQ9rb1nS71Jv+Rbt8U6F79BeEuYlzV+ubl wYmg== 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=k4gasz7E8Vka0VphamQPgsMwOl6rPaC5hW405KW6cAI=; b=pWPWYXELb+hlJAeCUicKim3zxXFXKJBR1Dw6G7vTBEKj841t/deM9UwRIKGoasTeJf 9zxX6hStbr0g53AdLucANYht3RZU6n/wULPIfE2VKF9dZHhdz+l679/94jazZoEmwKv3 yZ0Q15e4Dxe25rRmbvn6NA9eJ54Wnialhak/s6lCFQAk2AxbrocH9OK3J8KRknUCcD3n bGAOFZgcpyz6OmCiCK0M/6gOIwMjZQsm71kFFENj7tPdAFgq/bNuvkEP2iseX3gBGfZ/ sxm65k7h9GimC8R2rk2Hqfe0rWxJycSOEq4f1HRtRbvIzoyjW8i48jZfDmCTPOlTUEw8 J/WA== X-Gm-Message-State: AOAM533gNAWiXkJcxkJQiItE0C/ZB3SAy80PDPrJQ1gBkugdwB99GBPq U67hOryxEPyazJ7pxGFtI58wp4yv8xFifCW9CeYduv8MB50= X-Received: by 2002:a17:90a:2a8e:: with SMTP id j14mr4202521pjd.136.1590678065375; Thu, 28 May 2020 08:01:05 -0700 (PDT) MIME-Version: 1.0 References: <29bd753d5ff5596425905b0b07f51153e2345cc1.1589297433.git.andreyknvl@google.com> <78a81fde6eeda9db72a7fd55fbc33173a515e4b1.1589297433.git.andreyknvl@google.com> <20200528134913.GA1810@lca.pw> In-Reply-To: <20200528134913.GA1810@lca.pw> From: Andrey Konovalov Date: Thu, 28 May 2020 17:00:54 +0200 Message-ID: Subject: Re: [PATCH 2/3] kasan: move kasan_report() into report.c To: Qian Cai Cc: Andrew Morton , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev , Linux Memory Management List , LKML , Leon Romanovsky , Leon Romanovsky , Randy Dunlap , Josh Poimboeuf 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 Thu, May 28, 2020 at 3:49 PM Qian Cai wrote: > > On Tue, May 12, 2020 at 05:33:20PM +0200, 'Andrey Konovalov' via kasan-dev wrote: > > The kasan_report() functions belongs to report.c, as it's a common > > functions that does error reporting. > > > > Reported-by: Leon Romanovsky > > Signed-off-by: Andrey Konovalov > > Today's linux-next produced this with Clang 11. > > mm/kasan/report.o: warning: objtool: kasan_report()+0x8a: call to __stack_chk_fail() with UACCESS enabled > > kasan_report at mm/kasan/report.c:536 Hm, the first patch in the series ("kasan: consistently disable debugging features") disables stack protector for kasan files. Is that patch in linux-next? > > > --- > > mm/kasan/common.c | 19 ------------------- > > mm/kasan/report.c | 22 ++++++++++++++++++++-- > > 2 files changed, 20 insertions(+), 21 deletions(-) > > > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c > > index 2906358e42f0..757d4074fe28 100644 > > --- a/mm/kasan/common.c > > +++ b/mm/kasan/common.c > > @@ -33,7 +33,6 @@ > > #include > > #include > > #include > > -#include > > > > #include > > #include > > @@ -613,24 +612,6 @@ void kasan_free_shadow(const struct vm_struct *vm) > > } > > #endif > > > > -extern void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip); > > -extern bool report_enabled(void); > > - > > -bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) > > -{ > > - unsigned long flags = user_access_save(); > > - bool ret = false; > > - > > - if (likely(report_enabled())) { > > - __kasan_report(addr, size, is_write, ip); > > - ret = true; > > - } > > - > > - user_access_restore(flags); > > - > > - return ret; > > -} > > - > > #ifdef CONFIG_MEMORY_HOTPLUG > > static bool shadow_mapped(unsigned long addr) > > { > > diff --git a/mm/kasan/report.c b/mm/kasan/report.c > > index 80f23c9da6b0..51ec45407a0b 100644 > > --- a/mm/kasan/report.c > > +++ b/mm/kasan/report.c > > @@ -29,6 +29,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -454,7 +455,7 @@ static void print_shadow_for_address(const void *addr) > > } > > } > > > > -bool report_enabled(void) > > +static bool report_enabled(void) > > { > > if (current->kasan_depth) > > return false; > > @@ -479,7 +480,8 @@ void kasan_report_invalid_free(void *object, unsigned long ip) > > end_report(&flags); > > } > > > > -void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) > > +static void __kasan_report(unsigned long addr, size_t size, bool is_write, > > + unsigned long ip) > > { > > struct kasan_access_info info; > > void *tagged_addr; > > @@ -518,6 +520,22 @@ void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned lon > > end_report(&flags); > > } > > > > +bool kasan_report(unsigned long addr, size_t size, bool is_write, > > + unsigned long ip) > > +{ > > + unsigned long flags = user_access_save(); > > + bool ret = false; > > + > > + if (likely(report_enabled())) { > > + __kasan_report(addr, size, is_write, ip); > > + ret = true; > > + } > > + > > + user_access_restore(flags); > > + > > + return ret; > > +} > > + > > #ifdef CONFIG_KASAN_INLINE > > /* > > * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high > > -- > > 2.26.2.645.ge9eca65c58-goog > > > > -- > > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/78a81fde6eeda9db72a7fd55fbc33173a515e4b1.1589297433.git.andreyknvl%40google.com.