Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp260151ybl; Mon, 12 Aug 2019 15:55:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaXxtF4cCY1W+YPz85f/shvJE2mAbjZSSL72gIW2JsvQU8AIfCXc5+rWRPwaZWCQD3PkW0 X-Received: by 2002:aa7:9a5a:: with SMTP id x26mr8292298pfj.47.1565650512566; Mon, 12 Aug 2019 15:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565650512; cv=none; d=google.com; s=arc-20160816; b=kUHuZOL07pSZTPW0XCuD8XzA1YSrywfh4OYxdF9jrDar5hCbfw1ti+QIIjYEjS85wY FAx3skoBB2J+1Ul/0FitBci+FvLGe3oQj/8265An17bshqZ9JosNokuRoRMREN25RA/E mrTUvqL57T57tbQJ/5O2Xmd4ln2L+EBYCxpq9mytr53EZXY/BZtv7axxSLzT1Q1iVoB4 yC2/7ENjSgDEY8iSs/K3xP+rAz6ylRTCbLCcqyIYUHR9u83wdUtISPNkxLsNshmgNu+X 2jl2ZUtSOVVhKgVkJNRIU32i+05XcBVU44e0tN9qZ9Ofr6HY1XQwwDKU5kG6O8sFCUH+ nrow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Gx6QSLesJel3EOn97a01WuWFWtw8sELpqZv3XHH4TkE=; b=Yu4qTTsZ3E+RsQyFiTuXL1GOf79YBaODgnEHKNShFU2KjO7G8U9CR/B8ll7SQHUm3A fM1taBbxzhf1R2yWtQwYT2OjMWOIijRLSjwjfSWtGYIF9L3U/PAI+y9LLB/FzblJQawU 1ScTNdDBeF9+NktD/kpVYMa+XRz7qD43guu/7UvBdQGbkEPmB+7wO0gRcTz764tOxkY5 c7ZVvw/uduaKQAOqVN01by/X+2eu+XyeOyrmDEXeQ1D0Ujssn1Swt7+ywb3iQfO23MAK 8o8xjXSGSqH73QltAmSFStdGUyvUF63FEMz/NhBIaIOm4wx2SinOFiywqjQJPinw0Eni ckYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L7tL6lnU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si56904967plo.33.2019.08.12.15.54.57; Mon, 12 Aug 2019 15:55:12 -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; dkim=pass header.i=@linaro.org header.s=google header.b=L7tL6lnU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbfHLVm3 (ORCPT + 99 others); Mon, 12 Aug 2019 17:42:29 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:39417 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726488AbfHLVm3 (ORCPT ); Mon, 12 Aug 2019 17:42:29 -0400 Received: by mail-ot1-f68.google.com with SMTP id r21so158790831otq.6 for ; Mon, 12 Aug 2019 14:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gx6QSLesJel3EOn97a01WuWFWtw8sELpqZv3XHH4TkE=; b=L7tL6lnUwjerVWRjOf2iuk1/0vpIdnnLXUclicu9EOj4VQmxfw+195eNnnVP9D5A// s33XOs62eRI5nqcXjWFQ7zf64nTA66h/zrxAzyAdDspuxAMzibZe3qyVg5FhfifXwsCp d1faRADV2Hh1kbo/gA767R85R5ZSllgoT3i2cYwdPJDzTVQDFbgRsw4JWq6Cmuh5ecrL TPgnjcLkuOCnVuSfTw3+YqYAW+2pvCdj7LD9jEOqRpWrXF25XodfN1JsNeAby0bYpmJs yDqh2NyYAyvbvVOf3fQb9UZ6ZvC4ByheZUJwcFgaRyXh2XJcrBM7uJkg462XjZgeih92 /Zbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gx6QSLesJel3EOn97a01WuWFWtw8sELpqZv3XHH4TkE=; b=lUSdSBCXw59nVTKuTId+6uCyRlhEcNQlyvcH29EktU/ede5MVsGvuIowIUCHwlns24 5gfsR955tgHL9HbnvuNIYtznFJTdTm2aCXDFvBJbLaWJHYErYUgXIzdNr7wAQhVsmsJx /Q3gY5jFNe559jvxCC7iRaRg6jc0+KXm5K2jVzlR0NTRWWV8OUJkSwuSy/UoOLK8HDnG tDvTRcpPri+5ubuH34PUwfnNi+vpqIan6wV6XFX8XVvcLy2Cvbt0y0MxFQ9Gp/yTu1qj UFsBzWO2k/q2+OzBztF0AiQiOnl5LJj5o15X4JHBeW4dl7vyqKeWeL/fLO+Zrby/b3Qj nYjQ== X-Gm-Message-State: APjAAAWbElFN3tr6xzZ/rwhvJ2W9+PR68C7NgxHoJMuqbJ2tAl5oz86r +h8rDutjdtib1vRD4i1e3+ZzHNFz47YFemEKMldYCQ== X-Received: by 2002:a5d:9613:: with SMTP id w19mr6341798iol.140.1565646148509; Mon, 12 Aug 2019 14:42:28 -0700 (PDT) MIME-Version: 1.0 References: <20190812202251.GG9280@kernel.org> <20190812202706.GH9280@kernel.org> <20190812202947.GI9280@kernel.org> In-Reply-To: <20190812202947.GI9280@kernel.org> From: Mathieu Poirier Date: Mon, 12 Aug 2019 15:42:17 -0600 Message-ID: Subject: Re: [PATCH v3 4/4] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace To: Arnaldo Carvalho de Melo Cc: Igor Lubashev , Linux Kernel Mailing List , Jiri Olsa , Alexey Budankov , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Namhyung Kim , Suzuki K Poulose , linux-arm-kernel , James Morris Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Aug 2019 at 14:29, Arnaldo Carvalho de Melo wrote: > > Em Mon, Aug 12, 2019 at 05:27:06PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Mon, Aug 12, 2019 at 05:22:51PM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Wed, Aug 07, 2019 at 10:44:17AM -0400, Igor Lubashev escreveu: > > > > @@ -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? > > > > > > > I.e. I applied this as a follow up patch: > > > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > > index 01a5bb58eb04..ba8b65c2f9dc 100644 > > --- a/tools/perf/builtin-ftrace.c > > +++ b/tools/perf/builtin-ftrace.c > > @@ -284,7 +284,12 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > > }; > > > > if (!perf_cap__capable(CAP_SYS_ADMIN)) { > > - pr_err("ftrace only works for root!\n"); > > + pr_err("ftrace only works for %s!\n", > > +#ifdef HAVE_LIBCAP_SUPPORT > > + "users with the SYS_ADMIN capability" > > +#else > > + "root" > > +#endif > > ); > > :-) > > > return -1; > > } > > > > I've pushed the whole set to my tmp.perf/cap branch, please chec Please hold on before moving further - I'm getting a segmentation fault on ARM64 that I'm still trying to figure out. > > - Arnaldo