Received: by 10.192.165.156 with SMTP id m28csp803362imm; Wed, 11 Apr 2018 07:31:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MqK9QhF7rTwSIe7/26a47ZFbwK1RDoSJNTNsrdcSWuSU+UKtrq6KD2+MH4AULROa2leTz X-Received: by 2002:a17:902:5acf:: with SMTP id g15-v6mr5283614plm.138.1523457079244; Wed, 11 Apr 2018 07:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523457079; cv=none; d=google.com; s=arc-20160816; b=lFoiSeYHBdSytwdMcU0MBkMPgsMMF3BrFnDDENglykUXfgzixauyO94r9yGj5j7DQj YRpQHVwb88CwUSnwk25PetRGLBngV/GKbN1YK5LvJ6Vw3joQcKpqBgxZNkUUyglTIj/M pI3tgO4EAnzNzZGb47e9A6iQL0OzNdckK2xhGWygyHckUTDATS4laHKkTvK2qtdmXvo3 XBijK1RmpGGjpLoG2qfd7AFTAQsJN5ooV/qEGEyIxTiUB+lqazMj+MOFPgYxo1aLoO/e KD0n+j9b2JR5r3RE5jVjnjOsV/8L8IEpaB6jXOqsxc64wBkhSBe6gCDp2ED+CvLphEDR ZrUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=znTYWjJ0lbRrD2emM1FEZkBGN9EKNV54mgszzRDUiVU=; b=lHAYGZG4B9Z9xyUur3Gu2ul9i+5v2Wf/zV+4xhOcEUpuRZoDg5EjANXIb4okf8It/M raTr7/2Yyd5FGf/7QZlePAJabNUEuglB81/L0GaQ9SquBtHSRczKVjmGyQGn7dCQFWhc iORDKwTaZMV5QJAsPrz5KaAaySkMZCMfWkF6R0W9aMA8+7SoDYVGJRYlOTjtd+Eh99iA eMJ+Wdkg7aE1sw6FR5gEvwS6TgKpjdyE5oncF4hRLChAI3fy4CI76J65AVQhzK03amPF 3JzQnsxziUlzdQyocXaGOiQe5T81JeJnAd7gR2+eK/X0awK7TUj9oIC6j8CkhcrBSAIU WW2w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si1244174plf.362.2018.04.11.07.30.42; Wed, 11 Apr 2018 07:31:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753318AbeDKO1r (ORCPT + 99 others); Wed, 11 Apr 2018 10:27:47 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46998 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751972AbeDKO1p (ORCPT ); Wed, 11 Apr 2018 10:27:45 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3BEP5Kn072971 for ; Wed, 11 Apr 2018 10:27:45 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h9jxs40p7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 11 Apr 2018 10:27:45 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Apr 2018 15:27:43 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Apr 2018 15:27:40 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3BERdUI44892176; Wed, 11 Apr 2018 14:27:39 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5ABF052043; Wed, 11 Apr 2018 14:18:37 +0100 (BST) Received: from linux.vnet.ibm.com (unknown [9.40.192.68]) by d06av21.portsmouth.uk.ibm.com (Postfix) with SMTP id 4352052045; Wed, 11 Apr 2018 14:18:36 +0100 (BST) Date: Wed, 11 Apr 2018 07:27:37 -0700 From: Srikar Dronamraju To: Steven Rostedt Cc: Howard McLauchlan , linux-kernel@vger.kernel.org, Ingo Molnar , kernel-team@fb.com, Masami Hiramatsu Subject: Re: [PATCH] uprobe: add support for overlayfs Reply-To: Srikar Dronamraju References: <20180410231030.2720-1-hmclauchlan@fb.com> <20180410200059.731d87fe@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20180410200059.731d87fe@gandalf.local.home> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18041114-0008-0000-0000-000004E953E9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041114-0009-0000-0000-00001E7D5791 Message-Id: <20180411142737.GA16559@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-11_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804110135 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Steven Rostedt [2018-04-10 20:00:59]: > On Tue, 10 Apr 2018 16:10:30 -0700 > Howard McLauchlan wrote: > > > 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' > > I tried the above and verified that it is a problem and your patch > solves it. > > Thanks, I'll apply it and start my tests on it. > > -- Steve > > > > > 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. > > Looks good to me. Reviewed-by: Srikar Dronamraju > > 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)) { >