Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1495273ybm; Thu, 23 May 2019 01:55:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWbZDy2KVgAzUKsGDWJkN2JCfa31SRUsxRndhnCXpOQ0HUkoapfh5ATD/XKoKN8YUo0Fdp X-Received: by 2002:a63:e94e:: with SMTP id q14mr95610482pgj.110.1558601754020; Thu, 23 May 2019 01:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558601754; cv=none; d=google.com; s=arc-20160816; b=F8QeYBqnIs+1yVEyxSKndlwZ0YRM2G921si6+OAGgBarV+8aSLsOHqlLBQVQU3zXMk yF/2MVWf9h58AqpT2GK7P5/BDWhfCygiQXlwgd2ByenYNkdpXBney6pWWNz2XT+fOQ5t pYGpADRyVEla2WFmduVTaxpmesZvuZ2Q2itjcNZrrrzaJk4vHYMJmECyEXM5d0j1SBPm 5NX0z5F8ly+jAA9kFPR/Q/MPQEBlerVi+iaYoG/qaN4mAQ/HsSxh+z7ioaXEaA2t+uew swgJZWrK4SmSSFUpZmFO5wiuRl4ienqMp636n7I6CVQefC8e2YH+tcpGo+vKCAjNXCwT RjYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=sz4UZ+kS7GmFLyBvXVIykzQAS9lKB4VP6bT/MciVzPw=; b=TVHtGWmDb2ojovJZ8jYUqvUwqNL9tSqicAU9/KbLD4Yb6qxaZFNnChtgnjqZfLlUCc 0z8z9lb/pASLMjlSXaMl8m7WAy3A0fBO2Sk8hWedKIeW10zZcIiKbcR4jsOeBdDn4cej Xb46VXEgiltncna8DJcyMq6IlIQYZfQsAZxZYY0MV9b5h1yMUQzbrCk1pv0au1bJ1VxC XpfsbP4H+pEhgI2ijoRG54YlcvEn9EuQsB7yGJCTtVH7ojfp/L1gPYmlO0OPGSjDzhgZ +GXepHq9JTqQslAxfEOjMbiteQdPiTx5ANKtpaQ22d4p9V8r5M/wdbQaRryQH8XndY8q 2pAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w67si32801164pfb.125.2019.05.23.01.55.39; Thu, 23 May 2019 01:55:54 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730245AbfEWIwu (ORCPT + 99 others); Thu, 23 May 2019 04:52:50 -0400 Received: from relay.sw.ru ([185.231.240.75]:35024 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbfEWIwt (ORCPT ); Thu, 23 May 2019 04:52:49 -0400 Received: from [172.16.25.12] by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hTjSu-0000Q9-Mk; Thu, 23 May 2019 11:52:44 +0300 Subject: Re: [PATCH v2] kasan: Initialize tag to 0xff in __kasan_kmalloc To: Andrew Morton Cc: Nathan Chancellor , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nick Desaulniers , clang-built-linux@googlegroups.com References: <20190502153538.2326-1-natechancellor@gmail.com> <20190502163057.6603-1-natechancellor@gmail.com> From: Andrey Ryabinin Message-ID: <126d5884-b906-f85b-e893-a6a30ac0082c@virtuozzo.com> Date: Thu, 23 May 2019 11:53:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190502163057.6603-1-natechancellor@gmail.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/2/19 7:30 PM, Nathan Chancellor wrote: > When building with -Wuninitialized and CONFIG_KASAN_SW_TAGS unset, Clang > warns: > > mm/kasan/common.c:484:40: warning: variable 'tag' is uninitialized when > used here [-Wuninitialized] > kasan_unpoison_shadow(set_tag(object, tag), size); > ^~~ > > set_tag ignores tag in this configuration but clang doesn't realize it > at this point in its pipeline, as it points to arch_kasan_set_tag as > being the point where it is used, which will later be expanded to > (void *)(object) without a use of tag. Initialize tag to 0xff, as it > removes this warning and doesn't change the meaning of the code. > > Link: https://github.com/ClangBuiltLinux/linux/issues/465 > Signed-off-by: Nathan Chancellor Fixes: 7f94ffbc4c6a ("kasan: add hooks implementation for tag-based mode") Cc: Reviewed-by: Andrey Ryabinin > --- > > v1 -> v2: > > * Initialize tag to 0xff at Andrey's request > > mm/kasan/common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c > index 36afcf64e016..242fdc01aaa9 100644 > --- a/mm/kasan/common.c > +++ b/mm/kasan/common.c > @@ -464,7 +464,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, > { > unsigned long redzone_start; > unsigned long redzone_end; > - u8 tag; > + u8 tag = 0xff; > > if (gfpflags_allow_blocking(flags)) > quarantine_reduce(); >