Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2893777ybc; Mon, 18 Nov 2019 06:25:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxaHTU7o3sLpuG1MkqTY2AwHtFwHtXCGNbQpuH1ZO4NZOXxNfr40B5PLd+6RRcUfClU+PBF X-Received: by 2002:a17:906:d0c8:: with SMTP id bq8mr27365478ejb.263.1574087101668; Mon, 18 Nov 2019 06:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574087101; cv=none; d=google.com; s=arc-20160816; b=smi0Ostl3rW82LEbn5+F2J+PBW0SVlMAp1+PUnpr6QRW2nbf6pZqL+Lp5VhifFQn7C x8vLaX8tp/Rt9ZkiNNQu1eeaMCiqUsIw7wbipz59ZaJ8XfPKMs83rzODEMPiClMwJ0IM qIQodis/oVmKqT9MSIgJxW8tIIjVCVhC7gc80NRKG9ANBSNIqE7laOFWbsM/A9JwrOI3 F5i5xqqau/hcD8Y9/JPOZvLvlLrJveoXAyX5VMJrvG6/XSyh1/RRR3x4le6ilX2WiMZi nRbJRyPsP7Bjjohz3bRA4aFWN3x5pQCfOWt1QE+eIM3TjfYeCObN4fqu6SQzdW9PHAsN ffjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=AmWwa4/Fr6zBUbOpumfrfCIzsNS/izuknCf44THH5LQ=; b=mZUO2jSpg/tNX/pEgbhT2jWNjPaHLrLDHzPWImfDb9qP9qQ7pgRWQ+jvLWS8z/9fzK 5bt8daY9EnY8pFricIXajSjo8jOAytA+1j/GFOpFlnTiPaC+F/JW5EZW/tgjK31Drwwg A+09qPL4Y6oRaVybAEGjwsK/HKOP5Ga1PnZDk5QZ+Rw+wWItx978NOTIHZMT+wUaAclf FR3Cyf5ljOVtoxoAxq9BzyxuhL2b3dMjObEjSdHX5u1NZW7zX/as6cxZhvVy6Oeczsbx uyq8kyTmi+SPseYcVOEbntVJM4gOObZuWWR86zZ/+vvYqy5DCZNRYIrRiDeR51rg3ZXf BYQw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24si6925882ejk.280.2019.11.18.06.24.37; Mon, 18 Nov 2019 06:25:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbfKROUg (ORCPT + 99 others); Mon, 18 Nov 2019 09:20:36 -0500 Received: from mga06.intel.com ([134.134.136.31]:37653 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbfKROUf (ORCPT ); Mon, 18 Nov 2019 09:20:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2019 06:20:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,320,1569308400"; d="scan'208";a="258420312" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP; 18 Nov 2019 06:20:34 -0800 Received: from [10.252.10.190] (abudanko-mobl.ccr.corp.intel.com [10.252.10.190]) by linux.intel.com (Postfix) with ESMTP id 476A25800FE; Mon, 18 Nov 2019 06:20:32 -0800 (PST) Subject: Re: [PATCH v2] perf session: fix decompression of PERF_RECORD_COMPRESSED records To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <20191118122214.GB14046@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <924f076a-190f-330f-50e0-f06f35e2ee75@linux.intel.com> Date: Mon, 18 Nov 2019 17:20:31 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191118122214.GB14046@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.11.2019 15:22, Jiri Olsa wrote: > On Mon, Nov 18, 2019 at 02:30:04PM +0300, Alexey Budankov wrote: >> >> @@ -1971,20 +1971,32 @@ fetch_mmaped_event(struct perf_session *session, >> return NULL; >> >> event = (union perf_event *)(buf + head); >> + if (needs_swap) >> + perf_event_header__bswap(&event->header); >> >> - if (session->header.needs_swap) >> + if (head + event->header.size <= mmap_size) >> + return event; >> + >> + /* We're not fetching the event so swap back again */ >> + if (needs_swap) >> perf_event_header__bswap(&event->header); >> >> - if (head + event->header.size > mmap_size) { >> - /* We're not fetching the event so swap back again */ >> - if (session->header.needs_swap) >> - perf_event_header__bswap(&event->header); >> - pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx: fuzzed perf.data?\n", >> - __func__, head, event->header.size, mmap_size); >> - return ERR_PTR(-EINVAL); >> - } >> + pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx\n", >> + __func__, head, event->header.size, mmap_size); > > you're missign the 'fuzzed perf.data?' in here > > I think we should keep it just change to: 'fuzzed or compressed perf.data?' Fixed in v3. > > thanks, > jirka ~Alexey