From patchwork Mon Mar 15 13:56:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 401483 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 F0B0CC2BA2B for ; Mon, 15 Mar 2021 14:00:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4E0264EEF for ; Mon, 15 Mar 2021 14:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232827AbhCON77 (ORCPT ); Mon, 15 Mar 2021 09:59:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232575AbhCON7D (ORCPT ); Mon, 15 Mar 2021 09:59:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA1C164EFD; Mon, 15 Mar 2021 13:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816732; bh=HSLj3ADQoHdMtr4Dbq/x0gNxUKfHcE5nSbhTXuOcZpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ydzFLk1UMWhCw/oEXblArW44c6iEjVips7tQtGeuofPg2KOp5LpJUqX/WGXbe2ERK bnIeRzvuLYalJVWTfzkbb3dayKmfct2KpT29sJY/iUtnO78SZqZ/2ZR4Dukk+iLeUZ 4wzk7WgroIIyjrSwBSl51JMkpJ703/3D9kOIec/o= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Mark Rutland , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo Subject: [PATCH 4.14 25/95] perf traceevent: Ensure read cmdlines are null terminated. Date: Mon, 15 Mar 2021 14:56:55 +0100 Message-Id: <20210315135741.105111568@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135740.245494252@linuxfoundation.org> References: <20210315135740.245494252@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greg Kroah-Hartman From: Ian Rogers commit 137a5258939aca56558f3a23eb229b9c4b293917 upstream. Issue detected by address sanitizer. Fixes: cd4ceb63438e9e28 ("perf util: Save pid-cmdline mapping into tracing header") Signed-off-by: Ian Rogers Acked-by: Namhyung Kim Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20210226221431.1985458-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/trace-event-read.c | 1 + 1 file changed, 1 insertion(+) --- a/tools/perf/util/trace-event-read.c +++ b/tools/perf/util/trace-event-read.c @@ -382,6 +382,7 @@ static int read_saved_cmdline(struct pev pr_debug("error reading saved cmdlines\n"); goto out; } + buf[ret] = '\0'; parse_saved_cmdline(pevent, buf, size); ret = 0;