Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp494811ybi; Wed, 17 Jul 2019 00:11:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqycyM5gOnRhvrwWdsbJ0jKMM6Xg3zjbfjwdDM4k5zWUxZeQHCeR9uuQ9NQNuDCFibGa25EH X-Received: by 2002:a17:90a:7d09:: with SMTP id g9mr41318743pjl.38.1563347504011; Wed, 17 Jul 2019 00:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563347504; cv=none; d=google.com; s=arc-20160816; b=nNA9tcEC2nOoXh6HhlmX5EZnvZ5zzVWTE+Be468gzdTALWnZo0cAFZuzPCj/s29rio hroz4hpNvUPnE4pnh43mKLiRJijhWZpl5+4LIGpa1zldAC5m6wzGnPalUQSVR3ngRMZT pwIjNCQLCxHgBehdMrwu35UZz+nEvwE6an/gCNoHswOnrNzWoGlaurkeNm0xMNJ0I1zG aK2UPt7Byr4EqljUVfZlH3/rij/mulGlec5m6ONO7MCa91qEiax+OjeUKoQYrMs+5WKy 3kMAGbX8BBrBT2tziJzSdPwKdrSXL8TR821dvVnWjV4+uoDS5m2Ard8TwUx/DFBh/a4e 57Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RWVsie2MrifX/6SkgpbiQ4x392PPXLMpaLCoa1RRxbc=; b=BA2q4SYabxG5h9yFzcSAC0+TgQYrRSDrt5ahy4WNFT+91tljprcPLr7sbH6PVgqQDW a3E+zH0ovl5nQG6L9h5s3+UrNZWMUhAgLo5fwYWeJV0ZTaO9jROAZQ41ifgf2SW1LDAZ obn6HQZpAor7zbrU/XclUcMCxfcaE0egkE6radYf3EkRgUbf8Yd21YpwB9vWytyTFLiw b4YVarRJwk/u8CEECDOtYJzjSrp3mgie+2b/6B+v604DRkX5ImMiRCx4+FO283AOZUzz CZTU8u4OCT/sqUvIG1s+/iKx+OsdCD/2hPxSLML2Ik0IjqK5XsSfmx5bBef2kCD22M3Z zfSg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207si22565598pfu.258.2019.07.17.00.11.27; Wed, 17 Jul 2019 00:11:44 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726062AbfGQHKb (ORCPT + 99 others); Wed, 17 Jul 2019 03:10:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42816 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbfGQHKb (ORCPT ); Wed, 17 Jul 2019 03:10:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC8BB81F1B; Wed, 17 Jul 2019 07:10:30 +0000 (UTC) Received: from krava (unknown [10.43.17.77]) by smtp.corp.redhat.com (Postfix) with SMTP id 32C711001B0E; Wed, 17 Jul 2019 07:10:28 +0000 (UTC) Date: Wed, 17 Jul 2019 09:10:27 +0200 From: Jiri Olsa To: "Lubashev, Igor" Cc: "linux-kernel@vger.kernel.org" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mathieu Poirier , Alexander Shishkin , Namhyung Kim , Suzuki K Poulose , "linux-arm-kernel@lists.infradead.org" , James Morris Subject: Re: [PATCH 2/3] perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks Message-ID: <20190717071027.GG28722@krava> References: <1562112605-6235-1-git-send-email-ilubashe@akamai.com> <1562112605-6235-3-git-send-email-ilubashe@akamai.com> <20190716084744.GB22317@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 17 Jul 2019 07:10:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 16, 2019 at 05:01:26PM +0000, Lubashev, Igor wrote: > I could add another patch to the series for that. Any suggestion for what capability to check for here? it's: if (geteuid() != 0) { pr_err("ftrace only works for root!\n"); return -1 } so I think check for CAP_SYS_ADMIN should be fine in here jirka > > (There is always an alternative to not check for anything and let the kernel refuse to perform actions that the user does not have permissions to perform.) > > - Igor > > -----Original Message----- > From: Jiri Olsa > Sent: Tuesday, July 16, 2019 4:48 AM > Subject: Re: [PATCH 2/3] perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks > > On Tue, Jul 02, 2019 at 08:10:04PM -0400, Igor Lubashev wrote: > > The kernel is using CAP_SYS_ADMIN instead of euid==0 to override > > perf_event_paranoid check. Make perf do the same. > > I see another geteuid check in __cmd_ftrace, > perhaps we should cover this one as well > > jirka