Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515736pxf; Mon, 15 Mar 2021 11:15:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8KgADCjadMNVBpH5st9CynI4NjJj1Gp2pfE+prMjWyKw8whIE+3cIuz6IiEo1HQj43IeN X-Received: by 2002:a05:6402:510f:: with SMTP id m15mr31957756edd.328.1615832143230; Mon, 15 Mar 2021 11:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832143; cv=none; d=google.com; s=arc-20160816; b=k+LmCutkry0HqCkD9iI+oSSGz30/aFlTRkL5hC0OAMUPVDk71uAMelUrl6B1gomeZ7 z7G7wAkVPzemHp6zNnN6B6LA8bhxpbpe9a3pdnEVoVZGgQ9tu7Re4qgJouNbzVlJ2Cph W7TrVLIlxVzI2QNKvO9lNGz8BJhN8AkUMG8rdtbL0HF8XRt69EnI/BdZaYZRk4V3JVnB eOcqLNpDhvmcaPEZIx4pY70vjF7MT30ZNZ+axxpod3X07idbkHQCbCDvP6+6JKMrcqJD TO7q9k+yyH+XoV70JPOUNDCIGjRUnHXc6m1Ux5mHGQ9i/JzpAjXteYsySvFOitHo59SN jv4Q== 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=zDKsiuaWiN8auwh+MTlZ3TaL8EZnK0fGrqMSjfNTV8sBtH4TS3eujV6P/LUVdowH2z yxOHCGkkBn32sKsBZV2UTy3SQ6E20f5tIpjt3AW3uB+zP7cbYbkjJqx1gQF+6BOwwOD9 JeKbZrsQYogXpCs2yoUcshAltWya3yqRUj5qTKiuHVuNpEPCtaqWpVFWqnVnpfA8uC8w K48sznV5yq/TqTvv+sZwqUqiFiXgK4zgV98xiiYouIsev+TtmCtc4qtk0qUMJLlOSuyo BkGVXBGUyO8g6udtljtwLzqnOaIq8DbnPRh389UiEOdy7JFSdobB+GHULah4cQMy9smg US9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oXYgtgrP; 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 ss27si11698919ejb.322.2021.03.15.11.15.21; Mon, 15 Mar 2021 11:15:43 -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=oXYgtgrP; 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 S231594AbhCOOOo (ORCPT + 99 others); Mon, 15 Mar 2021 10:14:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbhCON7B (ORCPT ); Mon, 15 Mar 2021 09:59:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15CA864EF2; Mon, 15 Mar 2021 13:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816726; bh=4dxnC+z2O23rt+e3NSTNQYUyj91ckyhJEtphZAoFisM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oXYgtgrPtcSGFWr1Ev1ol2xW8hvQRf8oGEAjv7AGXbBpCKmeZDDl9GGk6JXXYLg8J qi0jQBjG7ia93m95vXi03Bo7MxPKOEJ+G8Z5Hvg4qzvpeY08oH/H+6lsFqArbSnuSM iXojKRvh6O1OeNatHDJ7PNhDcsTdyqcn/xeclEuk= 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.11 087/306] perf traceevent: Ensure read cmdlines are null terminated. Date: Mon, 15 Mar 2021 14:52:30 +0100 Message-Id: <20210315135510.589878830@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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;