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=-3.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 EBFF4C31E40 for ; Mon, 12 Aug 2019 21:42:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAA4D206C1 for ; Mon, 12 Aug 2019 21:42:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="L7tL6lnU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbfHLVm3 (ORCPT ); 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-Google-Smtp-Source: APXvYqwt49xvwotsJKc/cNOaXDlphf+EqnjZvINoE5+CnGxbY/po6fhZWP8cqKRsjzvFc2n4GYl/GZplqFVFtSSXUEY= 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 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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0B2F6C433FF for ; Mon, 12 Aug 2019 21:42:35 +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 CD6F62070C for ; Mon, 12 Aug 2019 21:42:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PSJF3Qvm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="L7tL6lnU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD6F62070C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AzyOLWaDZ/TN6VymshjD0Zbu2M9Zj9tV3DMefBPrjN4=; b=PSJF3Qvmk/K8An U64VvmiiYJVrycO/4romMhd/5J4Zzv4mB28ogOmqK4Bbs2LOQx7MFfOVMvPUOQMjW1xnhys/J2Hxi IIrwIHyH5vBbN84n0ZN24upsEjvaNuhXlh12HRpFTtAycsspby37NvDv+uEmNvhZBnI3oi4r/XErI fV5pwZ4AIBq4WMORXxAN+brepAbDMqwjpsNrgiBe3wHAqw78yUtdFruRjA7Pa0A8+tY2+8TG+Lfbj afQKkTZJxdKBc1G5P+/tKDXafxbVac8FMFbIOHk2FR7WdXMj4B+Z0ZMFemDx1fd3zm1NTCqALsxLg p+ZzVOKapVIx/AGJvhpg==; 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 1hxI5K-0008VO-6w; Mon, 12 Aug 2019 21:42:34 +0000 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hxI5H-0008UG-I1 for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2019 21:42:32 +0000 Received: by mail-ot1-x342.google.com with SMTP id q20so11802893otl.0 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=GCWcpK7aRFBqe8EwRnE5aexurJgazXS3V8/bGVT0XIKdYZ4MImqrDx7doyd6J9w4t8 zuhgUyh8/8i8WWZhuzR8niHjUogVcHh1n8fuN31WCcaCWWmkazWIHrm80WHXeyj/gndB JpJkIVJ9Rd43v50YpGTo2+hF72t9f2eg2ZxP6+zGzFb7RB3EBLzUQpDVIyVRjs/BbMPk G94RFLrhwUjB03NxPlORgJ9uHIP3sjf5YlqnHWvIoug7k71hSxVmSHV/FvPZ3Hxsb0QL 27oaGRjYjjIPWyCpUgT22Zpwet9a2re73GhI1BwIDvXP1eD1Ynz+3DfAMgwXIKON/Mqk d/dw== X-Gm-Message-State: APjAAAW2MVJL8SpSXPaPkmuuh0+vuH7OcHtpGiTFVeijFoktY4PahM8e 8ldaFp6H1IZgYz6njl1GeScXm8w+zfygJzmzJGR3JA== X-Google-Smtp-Source: APXvYqwt49xvwotsJKc/cNOaXDlphf+EqnjZvINoE5+CnGxbY/po6fhZWP8cqKRsjzvFc2n4GYl/GZplqFVFtSSXUEY= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190812_144231_660564_38F5624F X-CRM114-Status: GOOD ( 17.23 ) 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: Suzuki K Poulose , Peter Zijlstra , Alexey Budankov , Igor Lubashev , Linux Kernel Mailing List , James Morris , Alexander Shishkin , Ingo Molnar , Namhyung Kim , Jiri Olsa , linux-arm-kernel 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel