From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 070DCC433E1 for ; Wed, 22 Jul 2020 11:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D55DD20787 for ; Wed, 22 Jul 2020 11:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595417414; bh=zDKW70gtRYBxNcRCZwDBVRBmBO9V/xhxwmi6E5qgeqE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=f6P68fCnhZMEiA5VdzP4FuBkNi+f8yPGaSlfk2cLEBJjEzfsMTH5fNaNRduhPMmb8 5b5RtdERWcJ3UZ7PU0f/5pAp3uWUmRYePb0W0r5nVY8LE/cvG4DYoX0fw77Wf6q8Hc dSPSIOCJGg63LXbgBWPIaNI149ogU3muEYVSP4Wc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727825AbgGVLaO (ORCPT ); Wed, 22 Jul 2020 07:30:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:41152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbgGVLaN (ORCPT ); Wed, 22 Jul 2020 07:30:13 -0400 Received: from quaco.ghostprotocols.net (unknown [177.17.3.185]) (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 C477920771; Wed, 22 Jul 2020 11:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595417413; bh=zDKW70gtRYBxNcRCZwDBVRBmBO9V/xhxwmi6E5qgeqE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=htoisg+wZdskpQ/VrgTFuIOfe53U2SVfcUrgbJ0WUpoTdx7adkZV3fZuTgsIX6yNS XX+nyH+atCe+njcnvvGEHBzF+V5JRL740v6n6OR34r/Zqk23V2R5EolNHDFe4Ar8Zh uRfa4vGIjhKbvsTiW//KPMTRhzn2BI6+Hbt3ZhbI= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 16F77404B1; Wed, 22 Jul 2020 08:30:08 -0300 (-03) Date: Wed, 22 Jul 2020 08:30:07 -0300 From: Arnaldo Carvalho de Melo To: Alexey Budankov Cc: Peter Zijlstra , Ravi Bangoria , 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 Subject: Re: [PATCH v8 00/12] Introduce CAP_PERFMON to secure system performance monitoring and observability Message-ID: <20200722113007.GI77866@kernel.org> References: <76718dc6-5483-5e2e-85b8-64e70306ee1f@linux.ibm.com> <7776fa40-6c65-2aa6-1322-eb3a01201000@linux.intel.com> <20200710170911.GD7487@kernel.org> <0d2e2306-22b2-a730-dc3f-edb3538b6561@linux.intel.com> <20200713121746.GA7029@kernel.org> <0fadcf78-8b0e-ed03-a554-cc172b7d249c@linux.intel.com> <20200713185152.GA18094@kernel.org> <8d6030a4-ff2c-230c-c36e-d0a8c68832ac@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d6030a4-ff2c-230c-c36e-d0a8c68832ac@linux.intel.com> X-Url: http://acmel.wordpress.com Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Em Tue, Jul 21, 2020 at 04:06:34PM +0300, Alexey Budankov escreveu: > > On 13.07.2020 21:51, Arnaldo Carvalho de Melo wrote: > > Em Mon, Jul 13, 2020 at 03:37:51PM +0300, Alexey Budankov escreveu: > >> > >> On 13.07.2020 15:17, Arnaldo Carvalho de Melo wrote: > >>> Em Mon, Jul 13, 2020 at 12:48:25PM +0300, Alexey Budankov escreveu: > >> If it had that patch below then message change would not be required. > > Sure, but the tool should continue to work and provide useful messages > > when running on kernels without that change. Pointing to the document is > > valid and should be done, that is an agreed point. But the tool can do > > some checks, narrow down the possible causes for the error message and > > provide something that in most cases will make the user make progress. > >> However this two sentences in the end of whole message would still add up: > >> "Please read the 'Perf events and tool security' document: > >> https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html" > > We're in violent agreement here. :-) > Here is the message draft mentioning a) CAP_SYS_PTRACE, for kernels prior > v5.8, and b) Perf security document link. The plan is to send a patch extending > perf_events with CAP_PERFMON check [1] for ptrace_may_access() and extending > the tool with this message. > "Access to performance monitoring and observability operations is limited. > Enforced MAC policy settings (SELinux) can limit access to performance > monitoring and observability operations. Inspect system audit records for > more perf_event access control information and adjusting the policy. > Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open > access to performance monitoring and observability operations for processes > without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability. > More information can be found at 'Perf events and tool security' document: > https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html > perf_event_paranoid setting is -1: > -1: Allow use of (almost) all events by all users > Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK > >= 0: Disallow raw and ftrace function tracepoint access > >= 1: Disallow CPU event access > >= 2: Disallow kernel profiling > To make the adjusted perf_event_paranoid setting permanent preserve it > in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = )" Looks ok! Lots of knobs to control access as one needs. - Arnaldo > Alexei > > [1] https://lore.kernel.org/lkml/20200713121746.GA7029@kernel.org/