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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 5C3B3C433FF for ; Mon, 12 Aug 2019 20:23:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BF30206C2 for ; Mon, 12 Aug 2019 20:23:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pjArH8HX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF30206C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=To7jeo98XYxkmJ0ugLO46lGkpXnFZcYGCUwyGdGvXyE=; b=pjArH8HXy3UuII h0ttMC5VQeizsOBFmnmUoB3VccMCK/mpcyk7rDY5aWVsS5rmhiRfQrxzyQc+J35M15pFYpNGwONOM 38d8ZPnyXBbrYRjRxVfAiU4LgJKtg7WkrTQDLEVyoVun3bzApZAfw7i6/rCw9shwC8QK37MvX02LD Mf0aPPpEyr9a73wGzvsB1RZrACHkD0hpqmBdCHwZLHhqOz9nbvol/QjRNgvd/QjmFZToCl3vfz1da uUt11s0HkZQR4SuLb9lc0Segm/65tkATnR9obLe8PbPCstNl0uFYjZuAyrlNKkArQZVns0iCGxaB8 R1+dnEDpbfeB6cjB3v0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hxGqH-0005W9-33; Mon, 12 Aug 2019 20:22:57 +0000 Received: from 187-26-98-68.3g.claro.net.br ([187.26.98.68] helo=quaco.ghostprotocols.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hxGqD-0005Vr-AL; Mon, 12 Aug 2019 20:22:53 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3F25040340; Mon, 12 Aug 2019 17:22:51 -0300 (-03) Date: Mon, 12 Aug 2019 17:22:51 -0300 From: Arnaldo Carvalho de Melo To: Igor Lubashev Subject: Re: [PATCH v3 4/4] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace Message-ID: <20190812202251.GG9280@kernel.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.0 (2019-05-25) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , Alexey Budankov , linux-kernel@vger.kernel.org, James Morris , Alexander Shishkin , Ingo Molnar , Namhyung Kim , Jiri Olsa , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Wed, Aug 07, 2019 at 10:44:17AM -0400, Igor Lubashev escreveu: > Kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs for ftrace. > Make perf do the same. > > Signed-off-by: Igor Lubashev > --- > tools/perf/builtin-ftrace.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index ae1466aa3b26..d09eac8a6d57 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > > #include "debug.h" > #include > @@ -21,6 +22,7 @@ > #include "target.h" > #include "cpumap.h" > #include "thread_map.h" > +#include "util/cap.h" > #include "util/config.h" > > > @@ -281,7 +283,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > .events = POLLIN, > }; > > - if (geteuid() != 0) { > + if (!perf_cap__capable(CAP_SYS_ADMIN)) { > pr_err("ftrace only works for root!\n"); I guess we should update the error message too? > return -1; > } > -- > 2.7.4 -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel