Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3510569pxf; Mon, 15 Mar 2021 11:08:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKso/LvcCbe1iE9KV7QnBK3A6Nftt4qVAX2E5LYqu2S/KLOhRVJbZebPhMWnf6NPcKFliU X-Received: by 2002:a17:906:d8c6:: with SMTP id re6mr24344496ejb.311.1615831709973; Mon, 15 Mar 2021 11:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831709; cv=none; d=google.com; s=arc-20160816; b=OzfF20NHqhhnpeM0J2qK34lajgAf1JDFLZmz81TA2lAjz+XcqYYPQQe2OgC+gIBXHf 1lzFWmhSs1+1ETHlNB8pMF+hR0ikiSHWixOLfaO7JRRE1M5qO1xSoQqSUFEf/DB0pxLK OeaosPY8J1zDDRVVfDVmY/Y3mLAKa+K9Z3yvgyBhF8YcS+1wZJuKloQU24k5UDywiRIo LpNC9esGVngtddOenZ0j90gMS/rMStoCwFvM/1ErEopUA3lcxaEDGGfI5B6557ltYOvV Zr/YWgm6/gM1bKEyuEg0HbCoJLbMOHiCyk0RlmaHOpwHFmLMhccO4QwV5H5YiseL+Qxl 0nOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sbdXN9CQB4WRorOPPZ2A9wRZluFK1zM9JL2jDPT8ZT0=; b=SPPu85UQiBzYDD1BSeqgLBRsNvs9/8sW3uOfUBp2AqJtZrl7g0wMezWsEfv40I1jsg 5zHQX65xiafj1T2Q513xKndUWTxZCHTavEtf9coHU6TSnldcPdqp7PSxI8sooqxuY7+e 1m/2EsxyL2P3JneWgflBFuiMy/DrMGhpVho1ve4OzAfBiYJuY860P6TBb26qQiwCdGiw BTXn+R4osi/IU6ioFI6EgfvOXZL5BeRkJ/9ckZ7HWtiLsclO67kNoC89eEA2aSW0wTxw FyRfsWuRUzHWEFVczgHmnPNvxD4bsbVe1RO1M7djx3DbaSOQtUwgeSt3Bb4Q7N/PHRw6 dU9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2wHS+Px2; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si11622190ejv.100.2021.03.15.11.07.56; Mon, 15 Mar 2021 11:08:29 -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=@linuxfoundation.org header.s=korg header.b=2wHS+Px2; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235633AbhCOOIq (ORCPT + 99 others); Mon, 15 Mar 2021 10:08:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:35904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231683AbhCON6L (ORCPT ); Mon, 15 Mar 2021 09:58:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A59964F09; Mon, 15 Mar 2021 13:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816679; bh=4dxnC+z2O23rt+e3NSTNQYUyj91ckyhJEtphZAoFisM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2wHS+Px2KHvdz8z/6c6efeNLfnayP5q5fQhBWzSHPBU7DvAAp4heukOSgRQG9WXcz onGniNf515oNJeeQEgF7hxetOPzFnNYklPIKFSHoqXNdmUdEHYsJLkl6NgnPqp8U82 Bjumvgby9ynlCGekmJeyncjdKx13bwaRaW5k51uo= 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 5.4 042/168] perf traceevent: Ensure read cmdlines are null terminated. Date: Mon, 15 Mar 2021 14:54:34 +0100 Message-Id: <20210315135551.740860511@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -361,6 +361,7 @@ static int read_saved_cmdline(struct tep pr_debug("error reading saved cmdlines\n"); goto out; } + buf[ret] = '\0'; parse_saved_cmdline(pevent, buf, size); ret = 0;