Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4458595ybb; Tue, 7 Apr 2020 07:55:25 -0700 (PDT) X-Google-Smtp-Source: APiQypJLLpag0OJhfcgEY9xTMekDK/HJp4mMiaRl6fHFxuY3Ix4HLQ34/PJWw23jN3/Ps0cZHTAn X-Received: by 2002:a9d:77d1:: with SMTP id w17mr1914550otl.44.1586271325179; Tue, 07 Apr 2020 07:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586271325; cv=none; d=google.com; s=arc-20160816; b=wOg6HJdQ9AdbgHcSf7NaAY8h1yzh6ogj2HpeOBPBVUcnIHgAtsnVLdhAq+e/E4TviW UBrwyh279cF34BF11NrwM5I5eY58JAJQrEEHlFyezVcsOevoD57MRGtigz5UlQ84zHRy R2EpPU4fMruSfXBnvt37Zfhwr7jbUuqxuNXNfVV40CP/JgO1H8+U1Fc18Eb/wZxiXAl6 N/p9N2AJGIaH+S5tRR1AVsDIwlPTaV3XCbQ2CM7TbKi0Pe8+GADtks6vscOfa4utRdvr nmzZcnGgXliyl3jiXa+l9+SCPfRZ1e6i4GAX+p1ZXl4K2OvVm1EuE2Xw4IOcuBZDAwpI +/8A== 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:ironport-sdr :ironport-sdr; bh=JoZ1UVxHHb82dpbQXcYUvLpBtvU9tmPQx0o5StMQqJA=; b=QVjy0YIcb9E5Gc85dXX2+NfB7zhX6PnPXH1KnINs77HepdjU8HPqb/pCUCgX1ni+tg XVae4OcDdmm9sTzRP0iXjJwVRO5Hcx0b4ImdYa6if3M+YmySBIHRUmNIVFzVEF0PrGel EfwKm24NyLVhgDGSp2Ak0Nca2x9xZnEGwYXoZZGA0T2nP+at5KS134Nkvr5AXkmlgMlc W2MYkpJ+K2kvX/3y18pF2HUheb7ADvTjIj1R9/eCLQez6pD5RElLwR9EfIrWqnm0EPds UYiwUlA0IptrTD6PHqiFObxbyS/yZM6IZHymcwOmJuqQBvTgKj8qpl83SwpxXHSBOBoO lH7A== 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 184si1275418oig.33.2020.04.07.07.55.11; Tue, 07 Apr 2020 07:55:25 -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 S1729186AbgDGOyf (ORCPT + 99 others); Tue, 7 Apr 2020 10:54:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:25333 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728855AbgDGOyf (ORCPT ); Tue, 7 Apr 2020 10:54:35 -0400 IronPort-SDR: vzH2e/ETbj/Ls1bFDYAfNn5Ele1iE+N+3Ma3JrI+SPdUsapHZh3oUD0xO1TfDoiD54Jj6HW3PF /HcFSleC2vkQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 07:54:34 -0700 IronPort-SDR: cOZmMIE0ak5uQfYildm7qw134FQCkEL1T7TEy6C+ICKnfA8A0r6yAgOesc5pOEYZpwGdg1fk17 thIr/oSRo8dA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,354,1580803200"; d="scan'208";a="254480922" Received: from linux.intel.com ([10.54.29.200]) by orsmga006.jf.intel.com with ESMTP; 07 Apr 2020 07:54:34 -0700 Received: from [10.249.224.62] (abudanko-mobl.ccr.corp.intel.com [10.249.224.62]) by linux.intel.com (Postfix) with ESMTP id D324C5802BC; Tue, 7 Apr 2020 07:54:28 -0700 (PDT) Subject: Re: [PATCH v8 00/12] Introduce CAP_PERFMON to secure system performance monitoring and observability To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Alexei Starovoitov , Ingo Molnar , James Morris , Namhyung Kim , Serge Hallyn , Jiri Olsa , Song Liu , Andi Kleen , Stephane Eranian , Igor Lubashev , Thomas Gleixner , linux-kernel , "linux-security-module@vger.kernel.org" , "selinux@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" , "linux-doc@vger.kernel.org" , linux-man@vger.kernel.org References: <20200407143014.GD11186@kernel.org> <20200407143551.GF11186@kernel.org> From: Alexey Budankov Organization: Intel Corp. Message-ID: <10cc74ee-8587-8cdb-f85f-5724b370a2ce@linux.intel.com> Date: Tue, 7 Apr 2020 17:54:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200407143551.GF11186@kernel.org> 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 07.04.2020 17:35, Arnaldo Carvalho de Melo wrote: > Em Tue, Apr 07, 2020 at 11:30:14AM -0300, Arnaldo Carvalho de Melo escreveu: >> [perf@five ~]$ type perf >> perf is hashed (/home/perf/bin/perf) >> [perf@five ~]$ getcap /home/perf/bin/perf >> /home/perf/bin/perf = cap_sys_ptrace,cap_syslog,38+ep >> [perf@five ~]$ groups >> perf perf_users >> [perf@five ~]$ id >> uid=1002(perf) gid=1002(perf) groups=1002(perf),1003(perf_users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 >> [perf@five ~]$ perf top --stdio >> Error: >> Failed to mmap with 1 (Operation not permitted) >> [perf@five ~]$ perf record -a >> ^C[ perf record: Woken up 1 times to write data ] >> [ perf record: Captured and wrote 1.177 MB perf.data (1552 samples) ] >> >> [perf@five ~]$ perf evlist >> cycles:u >> [perf@five ~]$ > > Humm, perf record falls back to cycles:u after initially trying cycles > (i.e. kernel and userspace), lemme see trying 'perf top -e cycles:u', > lemme test, humm not really: > > [perf@five ~]$ perf top --stdio -e cycles:u > Error: > Failed to mmap with 1 (Operation not permitted) > [perf@five ~]$ perf record -e cycles:u -a sleep 1 > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 1.123 MB perf.data (132 samples) ] > [perf@five ~]$ > > Back to debugging this. Could makes sense adding cap_ipc_lock to the binary to isolate from this: kernel/events/core.c: 6101 if ((locked > lock_limit) && perf_is_paranoid() && !capable(CAP_IPC_LOCK)) { ret = -EPERM; goto unlock; } ~Alexey