Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp964929ybc; Tue, 19 Nov 2019 12:09:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx43Z1QH9od9hTGADHF2n++ymVncIZGNDbCupEGW3YLiE0cX+uY+YrLKIG3rZQi7B7Hbxfl X-Received: by 2002:adf:cf10:: with SMTP id o16mr41186115wrj.334.1574194170326; Tue, 19 Nov 2019 12:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574194170; cv=none; d=google.com; s=arc-20160816; b=a+b977SRW4bN4k1K+lr4qpswuElvMAL3PG0slATkQXvI4g/xslrpP74deg46+UHwCc ITd0poSMUUOo1QT0wTf9E+Mzp9o27/pxDNwMcpOvO/cXsAOpl872KQ0x8pNE5TP+tWSS /zEsKb29FeY5k5CTwacxqFSBBsCzhRpaJaHFpHGqSqEYLSAzcQkuP5xRoCBmn38fNPHM xfbXhl9hJAHNu21kWYyQSTbRJeM0Fo7CB5T753VUJnRjfmg+/JgeyCWA/le82CxeGU+V PKgt0CuvilL23e+mcUPbfohdigf0y4OCVyEetF0rWoUHywAb+hRsEkiI8igx21V2Pf8i Ud1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vZZsstpmsCTzgR0yQoMLhDAaOXbPXGn+7vwXrsmf6cg=; b=MN5Z3rpn6idLKWlmkKpeWNgxfTlfDts6clpd+V6elD6PsEmbpU4sNvwEBxdNhK6y0y YSm2H+LMULvpxgz7h0APQx3Fk9zYESHmYNf+NjeFPCqCv8aLvI+POtzKTBIDrSN3KJRC N8LA2YW+KLLj6QRqMHdcra2td8xatw15aFouajgmP95HQv27ubJitwcNNkV+M7L8JHGU aBWFI70vmXSTlv1ld6+UaJKBTulvLZ2GHYsBP072PEDHhycCnBcKpfvyt+vN5gz8/Pr4 f1r18zX7983bXmu27S7MnTJDXJfey0tmOq62tdg3XBMJsFUT4D5gcdILGoqqD7SCzFk3 pWjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fwbuac6W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30si17006058edj.289.2019.11.19.12.09.04; Tue, 19 Nov 2019 12:09:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fwbuac6W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727217AbfKSUFT (ORCPT + 99 others); Tue, 19 Nov 2019 15:05:19 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23046 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726711AbfKSUFT (ORCPT ); Tue, 19 Nov 2019 15:05:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574193918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vZZsstpmsCTzgR0yQoMLhDAaOXbPXGn+7vwXrsmf6cg=; b=fwbuac6WMRZFnmTzlRO1cKseAJFdpry9nQBeVDL27SdJxqTqttRA688KLpkJdFpMCp0QLI sNIkI/ryjUMJ+LJ/JNzWRIgQK2HvrUcbV9CxeEhdUpjpGt/aNv82lpXWsJGYAydtIVWgoR 58Q8/iNgeNqkdY9gB8VlBtcti8DZIaI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-Mp-Bzmh4MLGvC4QPuL-Cgg-1; Tue, 19 Nov 2019 15:05:14 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1764B107ACC4; Tue, 19 Nov 2019 20:05:13 +0000 (UTC) Received: from krava (ovpn-204-89.brq.redhat.com [10.40.204.89]) by smtp.corp.redhat.com (Postfix) with SMTP id 251E162926; Tue, 19 Nov 2019 20:05:10 +0000 (UTC) Date: Tue, 19 Nov 2019 21:05:10 +0100 From: Jiri Olsa To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel Subject: Re: [PATCH v3] perf session: fix decompression of PERF_RECORD_COMPRESSED records Message-ID: <20191119200510.GA7364@krava> References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: Mp-Bzmh4MLGvC4QPuL-Cgg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 18, 2019 at 05:21:03PM +0300, Alexey Budankov wrote: >=20 > Avoid termination of trace loading in case the last record in > the decompressed buffer partly resides in the following > mmaped PERF_RECORD_COMPRESSED record. In this case NULL value > returned by fetch_mmaped_event() means to proceed to the next > mmaped record then decompress it and load compressed events. >=20 > The issue can be reproduced like this: >=20 > $ perf record -z -- some_long_running_workload > $ perf report --stdio -vv > decomp (B): 44519 to 163000 > decomp (B): 48119 to 174800 > decomp (B): 65527 to 131072 > fetch_mmaped_event: head=3D0x1ffe0 event->header_size=3D0x28, mmap_size= =3D0x20000: fuzzed perf.data? > Error: > failed to process sample > ... >=20 > Testing: >=20 > 71: Zstd perf.data compression/decompression : Ok >=20 > $ tools/perf/perf report -vv --stdio > decomp (B): 59593 to 262160 > decomp (B): 4438 to 16512 > decomp (B): 285 to 880 > Looking at the vmlinux_path (8 entries long) > Using vmlinux for symbols > decomp (B): 57474 to 261248 > prefetch_event: head=3D0x3fc78 event->header_size=3D0x28, mmap_size=3D0= x3fc80: fuzzed or compressed perf.data? > decomp (B): 25 to 32 > decomp (B): 52 to 120 > ... >=20 > Fixes: 57fc032ad643 ("perf session: Avoid infinite loop when seeing inval= id header.size") > Link: https://marc.info/?l=3Dlinux-kernel&m=3D156580812427554&w=3D2 > Co-developed-by: Jiri Olsa > Signed-off-by: Alexey Budankov Acked-by: Jiri Olsa thanks, jirka