Received: by 10.223.185.116 with SMTP id b49csp5594068wrg; Tue, 27 Feb 2018 16:43:51 -0800 (PST) X-Google-Smtp-Source: AH8x224vXXZgpxNh6dIifrRwGJGIxMIRYpGscn1mQygff7XC38dwW7wlX3pkA+qPRPkXfJklmKec X-Received: by 2002:a17:902:a981:: with SMTP id bh1-v6mr15371611plb.298.1519778631212; Tue, 27 Feb 2018 16:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519778631; cv=none; d=google.com; s=arc-20160816; b=x7+3hhNKgOn7GUaH4uTpcXosbmobeTSd9R8X56LgaACPeRrxbfr88qrANBa1pMsgfZ BJwlCTi1HO6u1HXKi86sTv7tL0hLkyW2H3qU42jnDMpIP6aD1R9Xt31JK3Zo7TovBZ+4 V+3dPGGB1odOvk9nqFnf4KvYFr+B6EcHjyzgmHvXAeWEtArGn1/+L14ycjCHgun0D/fM PVZn8GRoyGiekNVdGHCCj4tJ4fkc76vqttnPsPKn9EZVTYOV0rERHGhIC5JlyiwsGEmN AmRg33abjMFzWbVnrlt8q4MXQ+LhOnUHYajq4AxFuRysdNN8gYpkP9ktlstRVA1oKlOk LTmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:arc-authentication-results; bh=vSd/OdoXg38Q5zU6qgEfMVtgAdCwNfNsF9tG02V6pho=; b=lijCaLxcs/8HgNaM00epqegGY1t8mXH11V9M3slWhR/ZG2kaG0Ai00L8u2o808yPsb XLj/oAprmrFZ0b77vmyJbuJyZsWMDX5r3FGGnfPd/0cjh1ZFFtLMaSdPYOBe4tbljsy7 pmgqu1XJgjeYiuB9TaaloIN9rC3b2GTFnfYoLq0jjuGApyCkKP5tYbyOfqDzPyOKbMtO UIHyb3gnesVKku0AFWNdhJh3dQ0KJsh6ub+g1rEFGlIFPpKuIql/rntSHtZMeajRIXld 8FUJbgT0r5szWgATaO9XoVFdk7ExGxXjMfAtZ/IoB/Y8mq38T/R1B5d5ReW6rkXzxS6h ap9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Gh5cThOX; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=YRog2OyA; 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=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l70si235766pge.778.2018.02.27.16.43.35; Tue, 27 Feb 2018 16:43:51 -0800 (PST) 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=@fb.com header.s=facebook header.b=Gh5cThOX; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=YRog2OyA; 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=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbeB1AlT (ORCPT + 99 others); Tue, 27 Feb 2018 19:41:19 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:52248 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbeB1AlR (ORCPT ); Tue, 27 Feb 2018 19:41:17 -0500 Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1S0e08x029591; Tue, 27 Feb 2018 16:41:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=vSd/OdoXg38Q5zU6qgEfMVtgAdCwNfNsF9tG02V6pho=; b=Gh5cThOXvBrsAgav0iV2u9SPU49Hw+nTOLU1LJISzYma17guDoEfj5yoQGNRbvQIC9gE yXxJq/XuniSAPpTJLj37CQN5o5G64seRwAbDT8RylsWtA1h2ihXObo9ZSvc++P5X398f NqXQWysNWn3zdj66LELD5aFUAqagxOOpe0g= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gdewr9mj5-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 27 Feb 2018 16:41:11 -0800 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 27 Feb 2018 16:41:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vSd/OdoXg38Q5zU6qgEfMVtgAdCwNfNsF9tG02V6pho=; b=YRog2OyAHtpxGc/ieQzKwpr0fkKYrEGcZ3JLQlzLs8tqlg8BiChk5blfFTtlxwhT1xLs/F/UqQAFD1AZq8QUZ2qVhyh7uMC+V1q7PWfQ5hnppr/WsRnPWHNkmfa6jQb6pDG/lMXsQMXy71+LJUdDcTa+qIN/O+QsU42bah8yk5E= Received: from hmclauchlan-ubu470.thefacebook.com (2620:10d:c090:200::5:5758) by DM3PR15MB0540.namprd15.prod.outlook.com (2a01:111:e400:c477::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 00:41:06 +0000 From: Howard McLauchlan To: CC: Steven Rostedt , Ingo Molnar , , Yonghong Song , Josef Bacik , Omar Sandoval , Howard McLauchlan Subject: [PATCH] uprobe: add support for overlayfs Date: Tue, 27 Feb 2018 16:40:14 -0800 Message-ID: <20180228004014.445-1-hmclauchlan@fb.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c090:200::5:5758] X-ClientProxiedBy: SN4PR0201CA0055.namprd02.prod.outlook.com (2603:10b6:803:20::17) To DM3PR15MB0540.namprd15.prod.outlook.com (2a01:111:e400:c477::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ebc9a04a-1a08-4e40-e7e1-08d57e43f485 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:DM3PR15MB0540; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0540;3:uSUVYvqrplkOiEZ6oFXUuQPcOf+0VDZ+Id8O62G+SkrITM1ymDtcgtiB5+zhITkrkT4zs9sIbmdq/kdLr8QUNcKHYHrPWEFWt//lRunAt6R+PqL7mAhhZTW9WZv++X2mbp+rvNwb0Lo2rKiaWMj2frrARXILdVAHcMuX63B7q6whvMmrpqVqxP66MDtTNnIaOAukST8LK0YfZJYMXSmFUgIL6Ik4+28aNKssQMDL8Z6WMsuV42JLFK6CJrAfMylI;25:SFN11rwLUzuIRGDaajHeDSedjCT4tNAfGyQK0gKMxBhcqWAh06TL0j3ACpNlNl5GDfb9UDrM7DtqcxczG/PFcjnFwVf7cNA6s91cL4z8cDX35hYjfp5f3HLSLii874l7MJ4o2KF0HGlv2qN+o4uFk87SD69uAvEFunaSSjP5zdDDC1LCtNrO1MvLsi41R5Wwvs+fu8Ts8tBodb8Y+5FByebkVRM7VyeBI4feMEeQmMv+5ZwdJl9AWiFszHa5bXKazRqBR0g6yNd1wxgGvbEwWUlad38djeFel35Neq6HJ1VwjCmFEctVKC0P5cOFz/meR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1AriJBPzAZRUDBTiCX+LfYb7PnFk845JYj+fG3EA5ny0iXx3nUhcelkZPnxQjHIN7jqAqPXS/I/6u6Yl6jxKNKEk6fxUDoCLwr2H/nQlkIPUGvltJU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(3231220)(11241501184)(944501209)(52105095)(93006095)(93001095)(10201501046)(6041288)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:DM3PR15MB0540;BCL:0;PCL:0;RULEID:;SRVR:DM3PR15MB0540; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39380400002)(366004)(346002)(39860400002)(396003)(376002)(189003)(199004)(8676002)(25786009)(81166006)(53416004)(6116002)(6486002)(2906002)(50226002)(8936002)(86362001)(1076002)(105586002)(48376002)(305945005)(53936002)(81156014)(36756003)(6512007)(68736007)(50466002)(106356001)(69596002)(7736002)(478600001)(6916009)(6666003)(2351001)(52396003)(54906003)(16526019)(51416003)(316002)(5890100001)(47776003)(2361001)(1857600001)(6506007)(16586007)(386003)(186003)(59450400001)(52116002)(5660300001)(4326008)(97736004);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB0540;H:hmclauchlan-ubu470.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB0540;23:UMJSbT75Z0RwNDUzyvSHGjZI5Zw2P/RfnQudDD4vo?= =?us-ascii?Q?6LCXBf1lUQQAOch9ybg6x0MnGlsrR7j/48GRRusG92jftStkAznsH8pg2Mqx?= =?us-ascii?Q?T3B0TQwb+HFK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UJunBnR93j7AhT/4zE0zjgD9zZ+aNkeMBz1DR/8+qRH30/Js3nS8z5D6DHbTtT/0hpWjVjXm7qI5Cyv5S2IvFeRt6QYN1qOHsy7npcMdoVe2MvhwqGB/50qMTHwC/giKx1sYSLIaBQNkEI/FDNrqHZZsJhfjAAZhgHN5eyNvQ5nw8bf651aaB/rmGzJOHe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0540;20:LwAHN22bGTCpCCyPUYG5H7jTwhFsMGuzxJpqBlUvrFUrzEei3OUVIZZ63yEpsnXdFQPTbz6lcITHu8bOHdP4FFPxbCCbjaVXgbLsoU1n24iOZ5ohlHJZuOhzO3WMLbCFA8TY8Pf424kBJCXoOYMvHzJfwNSer7SDKBi6natLDr8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 00:41:06.3586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebc9a04a-1a08-4e40-e7e1-08d57e43f485 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB0540 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-27_13:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org uprobes cannot successfully attach to binaries located in a directory mounted with overlayfs. To verify, create directories for mounting overlayfs (upper,lower,work,merge), move some binary into merge/ and use readelf to obtain some known instruction of the binary. I used /bin/true and the entry instruction(0x13b0): $ mount -t overlay overlay -o lowerdir=lower,upperdir=upper,workdir=work merge $ cd /sys/kernel/debug/tracing $ echo 'p:true_entry PATH_TO_MERGE/merge/true:0x13b0' > uprobe_events $ echo 1 > events/uprobes/true_entry/enable This returns 'bash: echo: write error: Input/output error' and dmesg tells us 'event trace: Could not enable event true_entry' This change makes create_trace_uprobe() look for the real inode of a dentry. In the case of normal filesystems, this simplifies to just returning the inode. In the case of overlayfs(and similar fs) we will obtain the underlying dentry and corresponding inode, upon which uprobes can successfully register. Running the example above with the patch applied, we can see that the uprobe is enabled and will output to trace as expected. Signed-off-by: Howard McLauchlan --- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 268029ae1be6..8b86d76c55ee 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -446,7 +446,7 @@ static int create_trace_uprobe(int argc, char **argv) if (ret) goto fail_address_parse; - inode = igrab(d_inode(path.dentry)); + inode = igrab(d_real_inode(path.dentry)); path_put(&path); if (!inode || !S_ISREG(inode->i_mode)) { -- 2.14.1