Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515435pxf; Mon, 15 Mar 2021 11:15:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzNcsKw9B7nwIfgUSEWZpxKRzvlkZLMMOInr8PkBuoM5U3k+cd9YR68/s9xWJtSPvNjO1J X-Received: by 2002:a17:906:dbd0:: with SMTP id yc16mr25192131ejb.71.1615832119875; Mon, 15 Mar 2021 11:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832119; cv=none; d=google.com; s=arc-20160816; b=aD/FD9W8I1RoKVs7e7IcY2QgUcb/e6f1pZbN/6FAG68AEVrnuk5Xz8uJ5WcitPD4/u 5cRkrNdOkta11CQdmka7J2b6+bHLdjM9yZXvXzezpeQeHSS+rzs4WhKeHeuI5u6DP0WT RDAKOxg2qinMn0sDyIZqM+dB9MhnBahebWwInYdVlESjaAlg438JpRKSH0WeFxJpHpAF ppf7paLDEvdeLguNl3xrhNmEKfpO37xEySsMWR4cAo2SKfUnlPfWka5aPTIKFJ9j7RYs 8uI4I047gP11QLmj3EJil+LJ2GXNAdCkbT1PT1IZWK1MnAOIjNY3TLjBBoLasMqUDmVt SD3A== 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=zBxJoLSx6EoCZf4ctCADKmVICYWDgdfxaBLautEDAj8=; b=vbzzNsCDDahyq+VdsYj1aYSHr+sfrE4mAmitrcdT4L0rTF3pdejIo/SbOSRbV3dU1L TAS/g6UvNleX7WpZ+Y+gJAHsbDfytKV6T/GfKcV+ujH0MfndGAWCk+WOPWtODNxvjYYE YWUxjx0el0qE1RSW3GkAwvyAwNZGU4H7tjZhoGMjK0K800W6xf5FMOvU0L2OCnJ0J8Hh sJIW6xeCE2m8WTVMsUwbHPbZf8lilHJGB5aCnckEMkUn945kwLo0NVh4+Kgxv1/1DdkW fR+5vNmHeCAgau2Jw03oWCtAgrCWTA+DyhdnexlMVeyLeoCotvCCushXzGUVevYP9gJH WmGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NJZacJF+; 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 y12si1753697eda.74.2021.03.15.11.14.57; Mon, 15 Mar 2021 11:15:19 -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=NJZacJF+; 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 S236281AbhCOOOM (ORCPT + 99 others); Mon, 15 Mar 2021 10:14:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:35446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbhCON7C (ORCPT ); Mon, 15 Mar 2021 09:59:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F11A64EEA; Mon, 15 Mar 2021 13:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816730; bh=OKkLkbCg2W00r81qQKKPpfcrBegDoduX/8K8hDlu5ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJZacJF+h1NodqpCBKPNcZcklqTzM4JTrMUdF8gav0LvDg2A5mmdPJ47zQc5HQMzw ioDClEVkobjEsLvagquRSv6xvh7oE4Rm/RyQyBOr4gzNnoabM9tQQoz+r3C/Ufcmd5 TzGhuCOM4W6e9A7IrWlL6PWYdAkL7SlNm4fv54tw= 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.19 032/120] perf traceevent: Ensure read cmdlines are null terminated. Date: Mon, 15 Mar 2021 14:56:23 +0100 Message-Id: <20210315135721.043891046@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -381,6 +381,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;