Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp483062ybi; Fri, 26 Jul 2019 13:11:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuqb5T0jxU24/eBcm1xKIIc1bF9t3vokP94rbaCLZ+MQVLfOcqKMWjfFA2g4zMl0Klz0bP X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr99671197pjx.52.1564171874806; Fri, 26 Jul 2019 13:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564171874; cv=none; d=google.com; s=arc-20160816; b=rY2q4YaOLknj6fRbuJuh/LIqMo4UPpzlvZRm8osI4gUkvwLFAyVBiiSG7UkT7SMYvq UI89kHiWimZISNFFJlMYy9fxvyKA0dWC/8uQyRBmLNgid5x0Hl1aWddqFWhGLIPVRxGW jZ+kmPM5oSX9WagN54m2UNMIsQEnnLmTXPmQml7ZWB8fY1tVT42UnJZmaaJk5+CkQqQv SnbCDYZbyIUBZ7lqAqNR/YxVPjkTIOVBAqUm19IQjlGhflZRX3uef3rlTizCHqYsV50z hgKKWlG/7wC5KmcbZmUI1wZS5mgvjDJSDluIuA0P5wam8z3gMRCHmjxCG8iEkCriw2RJ cjDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=jzVm99eEtizQN6p2EIQIgw3QNYuQc0g370x6MvZrtQI=; b=GuGGuduMM5wBL8RIhahOuxXP0yXNNZHG61EWKBVGHrEKui7qqws2S49wMoYZJTuhug zGzcVEbyDrWJ8hDPLvkG65ywOF8sf0OTvhuc5FvS2W8M/R2SyuuBtHHiwJDuQsE8WLer 4Nt9eYDNkL9VsoVtZH4pAH1XvMDRnDQQMfUlKUVnJadXgQinkYAFjmBxqTJoh9Uwr81G aqSOZM2HFoGAEdK4ca0gf1YM5WyX11VqVD0fladRXj4sSXk3odZ+fX9mDYV/BP0oQw/O /zmUhoLtBWacrThMDMrIKdzPQcd52/YiwGCt6+vrRfYgwxpEMHzYgB5Z/1pXfJPP74yc geVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="S0VKT3h/"; 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 q12si19574265pgt.447.2019.07.26.13.10.58; Fri, 26 Jul 2019 13:11:14 -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="S0VKT3h/"; 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 S1727202AbfGZTcb (ORCPT + 99 others); Fri, 26 Jul 2019 15:32:31 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:45929 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbfGZTcb (ORCPT ); Fri, 26 Jul 2019 15:32:31 -0400 Received: by mail-qt1-f194.google.com with SMTP id x22so48810777qtp.12 for ; Fri, 26 Jul 2019 12:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jzVm99eEtizQN6p2EIQIgw3QNYuQc0g370x6MvZrtQI=; b=S0VKT3h/856Z2rc5kuch8uu2y3nzzOKS/LJUN5Ys54AOJpRGQS+VCwRuHZsaJ13hIc 6qGaAIlbCVHo1M+LLmF9MiqTitRH3+f7E3u8jmfOoOmYm1DiSmxUbkyBueCZ/Tt6vW6Z YxFtIR4FSLemNOD4EvQySD7FwF2PEzxCehZv7LGtUsZMJtPf68TEhDAR/WR6iKmgKWCk DUG/LA2Vrij/4Y8aYg0iU6hYY2GYQJ8ORCU8aFwo+/JjTDPgRlbdvRrZvPt9gJc7/hZm oTLMSFAK3nOCgNcFSFUyMzqD0QQWm/2LoVdFrnxyMKJpASH+60WsCSS6SD+ThsA0f9TR r0iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jzVm99eEtizQN6p2EIQIgw3QNYuQc0g370x6MvZrtQI=; b=RTQZNrk5GDYdl5tEIRaNwf50+48FpksCkeHn2Fl6irkIDi6nY55i7yRciVHzcjdIlS p/cMnNTYv5NMP02irGaJBzVUdrkc3yGtiP8ZZmvGVStOG09qm3g/FT44It/CI0zZmzZ1 Us2M3HwNawyUEdgin53e6NrqqKq+HqU6Ty/HZKTpMDpCgooq9KzJ+2hTHDUwl0J64qQa 499e4IDfGLSGWN9cES5+VTvatC94CfWRfVlgkjxu24IAOcFJ+eAa0npMkb9Un7EbF0Xy hx/eOPpOvPBbAsF8dr9M8DAFYi8JkhQhyJ0z+JMtVJx/iBgPbfJv/pglRuHyAyoO9I3A kJqQ== X-Gm-Message-State: APjAAAUONuDUe8Z7aBZefGDHmoGm1iNa7vzPCJ1JiV9hUFDb1zGQhH8/ upeT8R0rXqQ0AfzZuobhuZwN2PSO X-Received: by 2002:a0c:818f:: with SMTP id 15mr65788290qvd.162.1564169550222; Fri, 26 Jul 2019 12:32:30 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.35.50]) by smtp.gmail.com with ESMTPSA id s127sm23713157qkd.107.2019.07.26.12.32.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 12:32:29 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 9E5F840340; Fri, 26 Jul 2019 16:32:27 -0300 (-03) Date: Fri, 26 Jul 2019 16:32:27 -0300 To: Numfor Mbiziwo-Tiapo Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, songliubraving@fb.com, mbd@fb.com, linux-kernel@vger.kernel.org, irogers@google.com, eranian@google.com Subject: Re: [PATCH 3/3] Fix sched-messaging.c use of uninitialized value errors Message-ID: <20190726193227.GH20482@kernel.org> References: <20190724234500.253358-1-nums@google.com> <20190724234500.253358-4-nums@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724234500.253358-4-nums@google.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Jul 24, 2019 at 04:45:00PM -0700, Numfor Mbiziwo-Tiapo escreveu: > Our local MSAN (Memory Sanitizer) build of perf throws use of > uninitialized value warnings in "tools/perf/bench/sched-messaging.c" > when running perf bench. > > The first warning comes from the "ready" function where the "dummy" char > is declared and then passed into "write" without being initialized. > Initializing "dummy" to any character silences the warning. > > The second warning comes from the "sender" function where a "write" call > is made to write the contents from the "data" char array when it has not > yet been initialized. Calling memset on "data" silences the warning. So, this is just to silence MSAN, as it doesn't matter what is sent, whatever values are in those variables is ok, as it will not be used, right? - Arnaldo > To reproduce this warning, build perf by running: > make -C tools/perf CLANG=1 CC=clang EXTRA_CFLAGS="-fsanitize=memory\ > -fsanitize-memory-track-origins" > > (Additionally, llvm might have to be installed and clang might have to > be specified as the compiler - export CC=/usr/bin/clang) > > then running: tools/perf/perf bench sched all > > Please see the cover letter for why false positive warnings may be > generated. > > Signed-off-by: Numfor Mbiziwo-Tiapo > --- > tools/perf/bench/sched-messaging.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c > index f9d7641ae833..d22d7b7b591d 100644 > --- a/tools/perf/bench/sched-messaging.c > +++ b/tools/perf/bench/sched-messaging.c > @@ -69,7 +69,7 @@ static void fdpair(int fds[2]) > /* Block until we're ready to go */ > static void ready(int ready_out, int wakefd) > { > - char dummy; > + char dummy = 'N'; > struct pollfd pollfd = { .fd = wakefd, .events = POLLIN }; > > /* Tell them we're ready. */ > @@ -87,6 +87,7 @@ static void *sender(struct sender_context *ctx) > char data[DATASIZE]; > unsigned int i, j; > > + memset(data, 'N', DATASIZE); > ready(ctx->ready_out, ctx->wakefd); > > /* Now pump to every receiver. */ > -- > 2.22.0.657.g960e92d24f-goog -- - Arnaldo