Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3531810imm; Sun, 30 Sep 2018 23:27:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV632JOm/IJ/h03PBv2YwUS6+UXSLFVyxnVR47sWwvjfuVBLof0hpBEMUmWCyKcqzfahUYG5b X-Received: by 2002:a17:902:3c5:: with SMTP id d63-v6mr10091357pld.145.1538375261355; Sun, 30 Sep 2018 23:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538375261; cv=none; d=google.com; s=arc-20160816; b=gQtMOxwizSulZYp0EtxrH8ZuWR4JYoqqB2rgdgSfmRBMpNqZ1SZGY2uJHfUwJ6SueD FbfoDspQILqzj5v4YCKhyOiLG2plrdm7O9hucdnHbXzk1QzJxqO+k7hClPkZiw3SvlQL ZxICWORXabhXVwzzRYCYNMIUlihmwbZPPUCUtlOt8TmcG7cp44AmrYoNvbpm/0wbdUvd ZMCkvZhiQQSW58sC07MxdH3pEh676I6LlSfgFJHOtNbfo073OjCKgTiMegYG1DnBg45h 9yNb+nxRzIegY++gpDEzEcvvBPmuCFODtqL9/y+YwaDBP4dWAqQ1rK6HWEkx0UEY9iH8 I+Ew== 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:references:cc:to:subject:from; bh=BiPJDDkUSGky1859PDbg0KdTFKmEHz+31e4y7iC3Mo8=; b=xOGcGf/fzlOzSK7nypXYStJa0h0k2huBLMfi5GRTtpd8HP76R5lAhJVNvfcbnF6DCL 5iGWepEMwIQT3GBwZvIC6/FTfc9XErv7mH2oyB3ynsFBLnsea9R0QxglgRzHpUKRW/b+ Lt0kUapo/kNzc9g98aV0pg83tvvjs1knbUyP/YTol/CZ+T5IXl6FreIGYA9S/dSB6DSr AFv92E/fzeeuh9G19hyGACwgRdcILi8KQ5q3ZGEqNxG22B4zTzJ2a2UT3Gi+Cpt5/LDH qQFWmY+7Hu2CDhQN8LvOcCYfbjw0NTY8ruGyac+KEXEGiAXdD+S/5FZnWjh7+ewcQtjN M+SQ== 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 c17-v6si10792072pgp.299.2018.09.30.23.27.26; Sun, 30 Sep 2018 23:27:41 -0700 (PDT) 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 S1728785AbeJANDV (ORCPT + 99 others); Mon, 1 Oct 2018 09:03:21 -0400 Received: from mga04.intel.com ([192.55.52.120]:2310 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727693AbeJANDV (ORCPT ); Mon, 1 Oct 2018 09:03:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2018 23:27:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,326,1534834800"; d="scan'208";a="261814037" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 30 Sep 2018 23:27:12 -0700 Received: from [10.125.252.7] (abudanko-mobl.ccr.corp.intel.com [10.125.252.7]) by linux.intel.com (Postfix) with ESMTP id 692DB580409; Sun, 30 Sep 2018 23:27:08 -0700 (PDT) From: Alexey Budankov Subject: Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting) To: Jann Horn , Kees Cook Cc: tvrtko.ursulin@linux.intel.com, Thomas Gleixner , tursulin@ursulin.net, kernel list , Peter Zijlstra , the arch/x86 maintainers , "H . Peter Anvin" , acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, maddy@linux.vnet.ibm.com, Andi Kleen , kernel-hardening@lists.openwall.com References: <20180919122751.12439-1-tvrtko.ursulin@linux.intel.com> Organization: Intel Corp. Message-ID: Date: Mon, 1 Oct 2018 09:27:07 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: 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 Hello Jann and Kees, On 29.09.2018 1:02, Jann Horn wrote: > Ah, I guess the answer is "0", since you want to see data about what > other users are doing. > > Does the i915 PMU expose sampling events, counting events, or both? > The thing about sampling events is that they AFAIK always let the user > pick arbitrary data to collect - like register contents, or userspace > stack memory -, and independent of the performance counter being > monitored, this kind of access should not be permitted to other > contexts. (But it might be that I misunderstand how perf works - I'm > not super familiar with its API.) > Currently *core* paranoid >= 1 (per-process mode) prevents simultaneous sampling on CPU events (perf record) and reading of uncore HW counters (perf stat -I), because uncore counters count system wide and that is allowed only when *core* paranoid <= 0. Uncore counts collected simultaneously with CPU event samples can be correlated using timestamps taken from some common system clock e.g. CLOCK_MONOTONIC_RAW. Could it be secure enough to still allow reading of system wide uncore HW counters when sampling of CPU events is limited to specific processes by *core* paranoid >= 1? Thanks, Alexey