Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1904326pxk; Tue, 1 Sep 2020 10:27:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZFbs4Oy//fL6cAy1q4iw7/CvjDqAA962v4LnV6T6Pn33eYV5l/KbL3/WuTU/5gwyXBaJk X-Received: by 2002:a17:906:8543:: with SMTP id h3mr2467564ejy.258.1598981231456; Tue, 01 Sep 2020 10:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598981231; cv=none; d=google.com; s=arc-20160816; b=OWD0kVZ7fZ6vx8xhmVSTv1rn++c7wY/aUrGH0SOwUg92f8UzTkyz1KrdjD/pbH2gtQ 53oys/mXboAPTEwXcmVgqDz/dMY7Mj6yVNX8MReUQWwxFEqsJ11nM9yaBRCNnfAw76so AQDVSaP7IbLvA9f9hMiePlZf1aJWOVnIZ3BXX/7jG58T0BFQVkRaoAs4qU2w/qSd1omO M5aSJVvgVQrKawytqxkshNqITo6f84u3T85stEtlBDu++aK2BfrZHMlVPvFasQ6NuVjV XrUc/AhvVZYuQY5jXhgD/Zs9EmrxyWSKcXSzVXhP1pT8FcRJpwWK5clOEnQxPSYuockM 6wOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=H1acb04Am2nzlXYBvjJiwsnHchjJPxe7YmUOvi3ZQVg=; b=nkIFfvcEUf8Xv2StXWVGg8dpCO2/6Re8q/WnssqMWbAXKdkgtIvQD0pikfSNOXg85N gXuDJ0pOmFH3L3dh3F21ROA9uTWvNgQNbVCqGT45fMtM6JzBq1/iISyteghnHSFp6FzE IcEF1vG0fn0R6zJS5Ky9/kycd/hXiLyZyMeQc055izwc7/V3tbWY6Fp4tTsPZSG6OEyd foTF6at84L5KVCn70rUm0EzZxFb8S05MLQPHB28B93cIgqP9Lti076GBwH51htHCn+ew mkmaENeEwCTbuFDH228tIozKZNTj+FDbJHcviQfBvOwUDwkjLA7bfGAcLrj1Pz4GC3f+ AHcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LykNUrVs; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s17si1037634ejy.13.2020.09.01.10.26.47; Tue, 01 Sep 2020 10:27:11 -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=@kernel.org header.s=default header.b=LykNUrVs; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728927AbgIAR0N (ORCPT + 99 others); Tue, 1 Sep 2020 13:26:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:57388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728454AbgIAR0M (ORCPT ); Tue, 1 Sep 2020 13:26:12 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BA652078B; Tue, 1 Sep 2020 17:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598981171; bh=fEW6oJfvn5Ucjhclk7f4qerwSkmRvaGzBLRUjhSJGCg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LykNUrVs3FSPdq/7Cys5tJ+kyZbOsgPy32lcNp8gZ3IFPvkRPuCF3SPnhYeGvltE/ VmSlzT5sDAUshbgs88HAmlibM+C1/yJZNnE3IZI6xWtHl9vCAiz4HrUdqsOjJZ5ufH 3JKDbb7gKEJS8G3jZo0pomhsjNQPwsiHa6EwJ0nU= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C146740D3D; Tue, 1 Sep 2020 14:26:08 -0300 (-03) Date: Tue, 1 Sep 2020 14:26:08 -0300 From: Arnaldo Carvalho de Melo To: Al Grant Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com Subject: Re: [PATCH] perf inject: correct event attribute sizes Message-ID: <20200901172608.GE1424523@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Aug 26, 2020 at 10:42:04AM +0100, Al Grant escreveu: > When perf inject reads a perf.data file from an older version of perf, > it writes event attributes into the output with the original size field, > but lays them out as if they had the size currently used. Readers see > a corrupt file. Update the size field to match the layout. > > From: Denis Nikitin > Signed-off-by: Al Grant Ok, so the author is Denis, has he provided his Signed-off-by? - Arnaldo > tools/perf/util/header.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c > index 9cf4efdcbbbd..762eb94bd532 100644 > --- a/tools/perf/util/header.c > +++ b/tools/perf/util/header.c > @@ -3326,6 +3326,14 @@ int perf_session__write_header(struct > perf_session *session, > attr_offset = lseek(ff.fd, 0, SEEK_CUR); > > evlist__for_each_entry(evlist, evsel) { > + if (evsel->core.attr.size < sizeof(evsel->core.attr)) { > + /* > + * We are likely in "perf inject" and have read + > * from an older file. Update attr size so that > + * reader gets the right offset to the ids. > + */ > + evsel->core.attr.size = sizeof(evsel->core.attr); > + } > f_attr = (struct perf_file_attr){ > .attr = evsel->core.attr, > .ids = { -- - Arnaldo