Received: by 10.192.165.156 with SMTP id m28csp55367imm; Tue, 10 Apr 2018 16:16:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/spOD3cT0x8X09RXoxbvXRXwkgTikiLDhIlFmOr1+IlhSSGABygSPhBuvoFjpbY9e7iShH X-Received: by 2002:a17:902:30a3:: with SMTP id v32-v6mr2418833plb.123.1523402200243; Tue, 10 Apr 2018 16:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402200; cv=none; d=google.com; s=arc-20160816; b=mIGQkqEA8SK9pVAVdBddWYXfG8yMVTX5V7Bzx2ZzeKlZvJmwosWXiwXfo6Kjuls9jH 01R3u6a/VrMXd5tuCNVjZVthS3cmAbdig4h14uF6hYqR0riUcayNUUtgh3IZT9NLVQbb 8q51HwNHFzFn9blo4OFQDVxgPS43J9+BzwmusCMA69wDynzi+JL6UpqaQcVahZpyI8jU 5Q76vSg/IFx4DzFROXjLTixN5QW3f959wyqyLUtTS6RbghPZSdXSTGSoP4RY74C2eU08 nX9lyyhTKeRQGOglgIUqPwX9CxY0qLhGvRe0wg20nuSYrxxkz+9+lgd0nFE4SL4TNEpQ B9YQ== 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=5lBYwMwjMpRnsY0d4AjJDoFyRtAHZRYBOhB0pFdTcMo=; b=ZtpqEwSSgdzYa4S9l37vZ4m10OnPQ4YFm27OfJcbwNfvNV4Zu+YE0JJy1SBh666qGQ n45zrLCc7Pa/g/pjsulsXhyWRJwKp3LM7ErDDv75riE7fDNG0yvcDI42yb5RyvkHemzJ 2PWcnKbP9efxBn5oQJyCUszdydtpCMZiwURIftfqhHu/4GwDf22CYcQEl4b3mzBBtPwb dlNrek+uTLsTRddSBCqt0/MchIZqnEqoGgnfhGBS30TxbUU2GSt/VHPl8vqE5AOOrJ/3 nwJXf8XIVZ5+RJlDriBmeHwmCYB42nfBKt2O211E42Xyi3F64TbtPKtnQ1h9vPL5pwqU DO+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Qs+2d4TC; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FVw5jEIF; 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 62-v6si3321934ply.494.2018.04.10.16.16.03; Tue, 10 Apr 2018 16:16:40 -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=@fb.com header.s=facebook header.b=Qs+2d4TC; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FVw5jEIF; 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 S1755438AbeDJXK6 (ORCPT + 99 others); Tue, 10 Apr 2018 19:10:58 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:49548 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752735AbeDJXKz (ORCPT ); Tue, 10 Apr 2018 19:10:55 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3AN6YZu019674; Tue, 10 Apr 2018 16:10:50 -0700 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=5lBYwMwjMpRnsY0d4AjJDoFyRtAHZRYBOhB0pFdTcMo=; b=Qs+2d4TCnIW9iQPxylonvQtEtzhOdHMRDKJ1kiUTbxFoXhLxYT357vuZy6Vxnm9uF9tx r5e+9DSG9akexqIXxoEL94TvfhoS891Gdb+AtwBVEcDERzNZnvYcSs+MDqo3cvTbu7f/ 9smX8qEubgYRAI1LZOnJbsjxxt7EsSKpGFQ= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2h94js0btw-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 10 Apr 2018 16:10:50 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.32) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 10 Apr 2018 19:10:49 -0400 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=5lBYwMwjMpRnsY0d4AjJDoFyRtAHZRYBOhB0pFdTcMo=; b=FVw5jEIF/MdUHdNWpzFPfkfdrqmrw8ETyRVdrK/0PAoNprtfRoTCPX+AreBGmxCRRI0BGDHocINmpxf+TSy+W1S9D0r/jNBoLZ9KvcGII0rH5YO5hwUggWPD6/s+Slm0/vPN2E4p96kTzw2OJ50IUkT/UzZ/ZyDt4P+oTs5SGrw= Received: from howard.thefacebook.com (2620:10d:c090:200::5:53e8) by BN4PR15MB0532.namprd15.prod.outlook.com (2a01:111:e400:59c3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Tue, 10 Apr 2018 23:10:44 +0000 From: Howard McLauchlan To: CC: Steven Rostedt , Ingo Molnar , , Howard McLauchlan Subject: [PATCH] uprobe: add support for overlayfs Date: Tue, 10 Apr 2018 16:10:30 -0700 Message-ID: <20180410231030.2720-1-hmclauchlan@fb.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c090:200::5:53e8] X-ClientProxiedBy: CO2PR05CA0097.namprd05.prod.outlook.com (2603:10b6:104:1::23) To BN4PR15MB0532.namprd15.prod.outlook.com (2a01:111:e400:59c3::26) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BN4PR15MB0532; X-Microsoft-Exchange-Diagnostics: 1;BN4PR15MB0532;3:3pglOatTFbaWLaQG6aJhgAxdi7uoUatibmrloU/iAPP2I6yq37I0r8+CcuMtgfBELaNEK8aYbs03hfem1tbuWnp0DtTgOETiIgtqzJ/48Ggz0ImbCBFsBdLL9zwCWmU9MoW0hKNsA6/VVtKmb3I3tA1jgnf2BxiKzyYLfP1urGRJYHV15Qcm3j/7cPAMCxExsipyMHOf5hQ0I/oW37VExscRaFQLemyPfhBQ2nj5YCgy9IzGU9i5Zp9wVVltGkHK;25:vjyXStgvAbm0QX986RMH+bxOFnkmxLfUZ4btsbWSUe6k0NH2oEHUg60IP45hMDadlU+E8vcoqZg1Op8QPxcy/Yrf6wCYCPzsnm8Y+o7Px2EC18HcMBuM8A6fXGexnOYRAkWpr/HV4PVbBDSCKEzWWnEiTQ16uqT5iDERmJ/m7cuSAmen4vcrEZqh4p7DsSK3N5EwiBPP83SVXRMcLkJK7EAdtUJr4PNU2hXA40suLpQd6VDw5C/ofTo44u2Fw08F32XWrPBOOpl/XxNW0cfDNAfzlQlwE/4l14KFbMuZzr0rsy6k4TMy/uPvqTKXNayvo9p472qLcGQXugxgamVnndp4Si6tCyyA7csbsbkNZpA=;31:XkVQ2x/T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T5eRDbC++L+YMbDOJ/yDurY5ehEd4Nwg0IsQmkbRGSL3NxJKjDUbYE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231221)(11241501184)(944501327)(52105095)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:BN4PR15MB0532;BCL:0;PCL:0;RULEID:;SRVR:BN4PR15MB0532; X-Forefront-PRVS: 0638FD5066 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(39860400002)(346002)(39380400002)(396003)(376002)(199004)(189003)(46003)(52116002)(53416004)(6512007)(476003)(51416003)(6486002)(36756003)(2351001)(52396003)(6506007)(2361001)(305945005)(6916009)(5890100001)(2616005)(59450400001)(48376002)(50466002)(486006)(16526019)(54906003)(1857600001)(7736002)(97736004)(105586002)(186003)(53936002)(106356001)(4326008)(5660300001)(6666003)(2906002)(86362001)(478600001)(68736007)(386003)(81166006)(47776003)(69596002)(25786009)(8676002)(6116002)(1076002)(316002)(16586007)(50226002)(81156014)(8936002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN4PR15MB0532;H:howard.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN4PR15MB0532;23:FWMgWhyeKlv8htd7BoRxuCvj4ts6DrDfR5kx2JFPq?= =?us-ascii?Q?MrqYBHdryZ7FtLn9e+Q9v5sADKyp4ae7EWr1qoGJCBVhTOZiHMtIAmNRqml7?= =?us-ascii?Q?nco5j0ZcdNQAkh9Y5OuVJJJzt1gaUymlF5snstdwiJWxSNlIgONnpRYXgBkJ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zA6BDbJawGlG4UharU2ugU29MIycVapjYqSmJ?= =?us-ascii?Q?SKQbdIe3yARUq5idrYIiGpU33bGLbp1Nl7Raa5pxMZ5vN1T5zMmBtuiGIlG+?= =?us-ascii?Q?MD3OA2mCRcPLCtYGmf7z5DKDAXVpPkLcALtu7MmgxqsBmi5f+kreIKnhH+KS?= =?us-ascii?Q?g/IuMfG9+a7MVuRCbIudU9C2AX3zV9eZnBrQFQOVyazmlhscmQ7dW3Ub0gyu?= =?us-ascii?Q?XOMoLACHCmxJvKymvaZKu+4TR/9P7QN9qR2SU6Esn6d+6UV08iG48BVe8Mx+?= =?us-ascii?B?UT09?= X-Microsoft-Antispam-Message-Info: EsqO4IvHL8nAs9Bm6FCnlVfPgLeP8kn8dFdqx7WgsyxAcoqQXR94uwV9OBL2uCXfFlpPYdvHm0cQSPsV0eM9JAyT4sdfckMMaQG9u7toSvcCAaNb6avdkbuw+GBYRasFt7KXWHSEvfsguLKEKsveBftNxXDII9u+LkErBYF8FCIt7sqmSN9SBniGTRnf4koD X-Microsoft-Exchange-Diagnostics: 1;BN4PR15MB0532;6:jR30NlYCkxEVDRhStHkr3oMPNCGgtVI216JZb+3bTMYaaLxZmyohuP3XiW4nCxHSPJWkBFlpDOiwfSGrs7kipqj7QCPA0ygVeNtpMNc0vQphCnBNFgmfwJQVBQSX5jzY3IcOWD85caEzk2aRo9Kzc0Jq8I4ljBU074t0Xi//ftSkqLzGtgFAjU1eQXiUBRhrQZlMewc6QhVE1Oca/demWvaTnDPATtWwY0RQJV784ZSjVWlCs3U8hZGJNZej/S5JfRI87dX3Ye2u3aaUHDdf34DniRlSrCYmGQVNoEDyZFqBCN7GCAU3ofgaeojduffepGZ3i4iQJRni2/SKzIAnMYmmdQ1aW4awsOtTxEHTNYfYu549e01jUGJG/hkzZv+k0OFZCeVXLKgrDLUonhRW+i1Z760dKi1bADzh2f4hwiD9x09e0vVe2kJrICg7QM4146YE3xePv/fuhDidHwTTCw==;5:vYgbOoI/H8OXmAnc4HxjFBNfpzzXEonN8qDYYsQ9JKPSi5YEzsbtC2vUufdKEvm2gh6s6mLZOhUKlZPXYdGVz7Nu4OZoNThKmg0ii8yAtG2ECGlY8fpAHYKlUiS3+PlvSsxBVd4YDdjYQAwmxV+BBn2BOL4a6ik9KFcPRjpsVks=;24:W33Q+BJsUB0QLcjcny3Ff09iy9/WzjX2tRXSOgBIioSJOnzeMaAPy3+ZBIbO2g3n6IaQNgWVXQOZFcTYvjBeLlleKSbYVKzMJgBO4Omgod0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN4PR15MB0532;7:ALBP/2+2d+0fPUOJPJrR9xT71ueizKHc8NnuNLd5udvScFnKyPSrE7G04NDu8cyQXH2FrLZ3gj+OQHcthe536xU9zi12Jn+CVPjBQqN1/Ypdm3dDJlQK7faTAaIJh6zaFISqzL6LlLIXtYCHGW+UvSJVcl5XYuNy4LPZ6d/oadZxrgotCzE3C5xHMGDxGTm+gQpmAUYLvH2hnL0QhbGkkKnGLApNYHJFblfyXI80IB7dRDOd8HA+tQtWqnP9tp9y;20:bkl0vuDDKTjCEaOBHmSQ8HZVz3z0/JU9xTBw9BmWmXTI1L0FKQxnGbXMm9rKc/ZtFaBjbvpMt85LulMNFBgjLcgbFlKxSDN0J0YyarQK6FfCiE10OBxcu63Cs8vJa9Mu49zQACvAjtjJ6b0N7J0baunABdVari4V2LOalV0PdF4= X-MS-Office365-Filtering-Correlation-Id: 8bb9522c-cb0f-4317-eab4-08d59f384a0a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2018 23:10:44.4511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bb9522c-cb0f-4317-eab4-08d59f384a0a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR15MB0532 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-10_09:,, 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. Reviewed-by: Josef Bacik 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 2014f4351ae0..17c65fa4136d 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.17.0