Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1212367ybi; Wed, 17 Jul 2019 11:18:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqw43Sh/WqOoezkbP7Wl3zr3hJZrxmZrF7n9FE6rzH5Dsj0XnG82JgZAYgSS03BTTdiegNlk X-Received: by 2002:a17:90b:f0e:: with SMTP id br14mr45696072pjb.117.1563387483145; Wed, 17 Jul 2019 11:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563387483; cv=none; d=google.com; s=arc-20160816; b=ovF/mY3yA7DkfgaE2zUZKkg1WeM1saGbg05iu43lOV0CwAOOj1ydO3hAv69tditfWw 7iBtY2itL7b5gxWlEKq6Qu3QUB4WgvKWQp53ExMbh/BjM8vw9kQUQpMI25X2bZmzmk0s P9b4EamXp3x3ltKvGiJP5Z4/dzSGSTsrj4aNI/L4ozEqz1dHq80LV7uZg70Q4GZoVMMW KiZocZ5wKsK529XMTyPJX74sOYObuw6RQsFFMOjZrDKbUultCzj9BRsdjBDCmXcKgF8L NNvKk/qOyRagUAR0RuGvtenMsx5zL1XvSJ4nYFkZTNs/+DXkfxrhe1mHdQ6TSqbTjGIz tikg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kNrrgDyv5tzQGL0dQcW1y9uDTJw/uB719If7Z2ZV22k=; b=proHcRooCKHov6JHC8ftpJPNxewprqEaOX5oSowb9lmmrOtSsa3ou6kWDYd8wegCEh 8zx3TDLBZaBTdxwnUjbeQ/u49m0Aph5qAH4xm+V8nFfrKMVsJByiSHC4+MLNhHhw6vWV 77nV/zxPWg5tGo+VNNHHIc4owF/cTxHgPLPJCjc4GnLERttq0xrj3GiDE2l8hNuvl7zM j10OLc9hY0na0a0hMbESLnMnQfXEpGQ97lKM6ktoEVhOfn6ABnpqWhYrFtydCC5PHBH3 EGUAp/785QH2f2Dt8+Uhncp4hEbCBYwn/Yc9ifw3nZbCOyGNqsDMOGUMuufBw/bO6izu u2PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=KVJR3PnB; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si22822280pls.148.2019.07.17.11.17.46; Wed, 17 Jul 2019 11:18:03 -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=@akamai.com header.s=jan2016.eng header.b=KVJR3PnB; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388909AbfGQSQu (ORCPT + 99 others); Wed, 17 Jul 2019 14:16:50 -0400 Received: from mx0b-00190b01.pphosted.com ([67.231.157.127]:30232 "EHLO mx0b-00190b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727286AbfGQSQu (ORCPT ); Wed, 17 Jul 2019 14:16:50 -0400 Received: from pps.filterd (m0122330.ppops.net [127.0.0.1]) by mx0b-00190b01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6HI7jMx014943; Wed, 17 Jul 2019 19:16:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=jan2016.eng; bh=kNrrgDyv5tzQGL0dQcW1y9uDTJw/uB719If7Z2ZV22k=; b=KVJR3PnBZxzOh+wflRSxGyKvTVgd5Q2dQYLBUAG2j+0pUyjv3dDIdZxytJiHHRJSOTiQ hA4LlTIxaa8OqW37RLRZuo7Z6Nruv0SO6FE+hYgGlWhBoBiTu3FVfrdvYonlFJLKIjUA pn0FmJCgOmTHUhyR8XdGXYI6uVnOxdQlGDe6CgEuspCebnidIM/JSt3OiqMrepbYaVRS osO0VKjJgeeHNJ9D/UXnVG1sQgHC2y3eVR3vqaAWMIMmbkb6WYkvSC7F21YNnMf07G7t AYnxWa8YOC5F5CoJoBMDCluX97vn+xmsM5JVEKA0GOHR0Obe99A0Gmd11kGW6tgP2f+L fw== Received: from prod-mail-ppoint3 (prod-mail-ppoint3.akamai.com [96.6.114.86] (may be forged)) by mx0b-00190b01.pphosted.com with ESMTP id 2tshpnmtem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 19:16:31 +0100 Received: from pps.filterd (prod-mail-ppoint3.akamai.com [127.0.0.1]) by prod-mail-ppoint3.akamai.com (8.16.0.27/8.16.0.27) with SMTP id x6HI1q1w002792; Wed, 17 Jul 2019 14:16:30 -0400 Received: from email.msg.corp.akamai.com ([172.27.123.53]) by prod-mail-ppoint3.akamai.com with ESMTP id 2tqan1genp-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 14:16:29 -0400 Received: from USMA1EX-CAS1.msg.corp.akamai.com (172.27.123.30) by usma1ex-dag1mb2.msg.corp.akamai.com (172.27.123.102) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 17 Jul 2019 14:16:23 -0400 Received: from igorcastle.kendall.corp.akamai.com (172.29.170.135) by USMA1EX-CAS1.msg.corp.akamai.com (172.27.123.30) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Wed, 17 Jul 2019 14:16:23 -0400 Received: by igorcastle.kendall.corp.akamai.com (Postfix, from userid 29659) id E441261E9A; Wed, 17 Jul 2019 14:16:21 -0400 (EDT) From: Igor Lubashev To: , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Alexey Budankov CC: Alexander Shishkin , Igor Lubashev Subject: [PATCH 4/3] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace Date: Wed, 17 Jul 2019 14:15:59 -0400 Message-ID: <1563387359-27694-1-git-send-email-ilubashe@akamai.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562112605-6235-1-git-send-email-ilubashe@akamai.com> References: <1562112605-6235-1-git-send-email-ilubashe@akamai.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170206 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170208 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs for ftrace. Make perf require 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 9c228c55e1fb..2f632b11ebba 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"); return -1; } -- 2.7.4