Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515554pxf; Mon, 15 Mar 2021 11:15:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7WKBkCvZBdBK2alXfmtPqWMPUc6LsKCuX0iRrF2ZgmqRWBOvK6k5kqRLQLH3t/rP310aw X-Received: by 2002:a17:907:7684:: with SMTP id jv4mr25729496ejc.231.1615832128313; Mon, 15 Mar 2021 11:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832128; cv=none; d=google.com; s=arc-20160816; b=ymBwFvtEOllhIBYZUaUEcQQRfQEn86YYkmz/nt6NuKBmh2OXeAzsmBHq8InlY/aCpq uUkv3q5+SXb3aZ1kSD6rT/fjtpQJPFjietqCd4xjMN/nXdvSHEATEjelTVdbejZOk8Zw 5FIOYBP3lXP1lfmQqn9TOA3DHWoawFeEOyj9d5y9ZLudvHIKWlvBLafIJaWCNuyLOzMc 6LPJdWMBU1yBWIueqOUERgJpwg/Xp8bLUNrqx4NmBwzJ6notisyz3e9eYEcXJOXeeQ/m I4PswrULK0u2TSNYanTDDpGBwI763TzI5RvdUX0ghagS+vOAfrshcvRKzcvw5wvWMqC7 aUIA== 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=jbpErvzttElIG6T7dk1CRwlELXy4pLrXRTM/BpYYTqXQ5nHVihpoYXid8MbugaURtT q/3r6OaJeX1mOTSZUs4+LbaMBRFPGrVPxlz4yeM8M+V/iviQ8cOxDX1GdPgcZ8iLUGZp 7QjOKwcNAkLXLnPqdaJcX4s9z2WF1I1MWIshf13hNxcTaHAcgb82I+SqhjHUDQ8KgYdD vTDZPnmNfjd/Wk3gtSKHdmyB9o5nrXCnEkUc7mUtC+lV2Exk1uImMX4QjR4ycWXPOJxW SQLUldF9T81Tg5KvuZLJMlsaPOJ538mjHPf0Csxr0cpHQgYR0vwkrcyTtnGLsww7lkUK HUlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DaeF9ytE; 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 zj12si11230954ejb.508.2021.03.15.11.15.06; Mon, 15 Mar 2021 11:15:28 -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=DaeF9ytE; 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 S236333AbhCOOMr (ORCPT + 99 others); Mon, 15 Mar 2021 10:12:47 -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 S232467AbhCON65 (ORCPT ); Mon, 15 Mar 2021 09:58:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6919C64F48; Mon, 15 Mar 2021 13:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816718; bh=4dxnC+z2O23rt+e3NSTNQYUyj91ckyhJEtphZAoFisM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaeF9ytE/V1mKQ9bKpIsiItZRrHdRmqx5oJMVT48HaaY5jbAlQZQBdBKqSBOCumYH IA1sqzL5Xdt/UOY/chqPs6KdpQMmVHia81rZMTKSBm3LxJe84qc7qh+89UsYLMdky2 2y96ry5+JexnaptFFt0AwfEXXl2HK+YA6MOMYSI8= 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.10 073/290] perf traceevent: Ensure read cmdlines are null terminated. Date: Mon, 15 Mar 2021 14:52:46 +0100 Message-Id: <20210315135544.376366571@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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;