Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1444134yba; Sun, 5 May 2019 06:32:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMHIkcb+oGSwonQjGcTSnKcUjUQA0165vs62lmF8eRVRIYzUgz89oH3HkZj7R1vraTTJTR X-Received: by 2002:a17:902:a585:: with SMTP id az5mr24601626plb.261.1557063167087; Sun, 05 May 2019 06:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557063167; cv=none; d=google.com; s=arc-20160816; b=fMHmG94tH374G/9Cc/jQT2h6LImMlP0X4WCm6WyBrs4pu90ioLQs0693amfIhjTT5W L6ZTufo9UcwXl3CUSz2Iy2FJ+IUnvpvCfyenZKsy3hXKDnoPHCgksKwHsGBEWssNk3Gf 1TsoBHSgll4yOjjeJd5h9L802zLW2ogS6djqRndB1IBTaCw4ydhGlTTah6qDL6WTGcC0 HFVLlfpInKBggIK+EA1JL0rgKz3Gw4gMPPRXKFY5Y4svBBV0d2BwK/tY3INyzMHhLMoD ohul5T87zxmSWk67aZZTtPwVPytAUkdR+CbX4XytKwtB8DSdbVLdhyk7MN7O8+vU4jCk YTQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FVTuUgZ01YXadVlQNhQr7mpUWbZJ7nrRUcoMljAwu28=; b=agI3l0NoYIRGR9FbbPtfCgNSLa3HVBBBC0itLCVblBfLaC6LB7yKlJDveo3aGebkmi aiIcJRmZezwavooWi4MHX2B6O4eKvKtiAGJekDgKhKWlZE8cfP0X2CwduP3UnKQqb+GI qLTLl2+/50FAOq+5pz/830BAv2Q4YeAafAEXTQY/+v9s/JDAKBdNXM78xcvyciEBsS4t VxAji5Zy7LCl23fg+9+arFaK/4KI2ks54th3429/lhHvV7WoL9n/F9giHYKnCMEoJ4gi xgfox9bNnhkAw9CCyAHEXmfzmXxk8K/h4VF5HOQ/b5Vtk5pNbZhaNeI74RRHGGhygMBY /xhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=tzLDfizm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62si10992279pla.107.2019.05.05.06.32.31; Sun, 05 May 2019 06:32:47 -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=@joelfernandes.org header.s=google header.b=tzLDfizm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbfEEN3x (ORCPT + 99 others); Sun, 5 May 2019 09:29:53 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44832 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbfEEN3x (ORCPT ); Sun, 5 May 2019 09:29:53 -0400 Received: by mail-qt1-f196.google.com with SMTP id f24so1459554qtk.11 for ; Sun, 05 May 2019 06:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FVTuUgZ01YXadVlQNhQr7mpUWbZJ7nrRUcoMljAwu28=; b=tzLDfizmuuEN3EDvcf4XM9cDHdXUAph2dIe3y0AZVgDhm7k8YTzTOql13AmZkoNXKP AdCkfE28TAUSfc7fRLSsuFb3zmW6oEMhF4Dyq+V+iStvd+QmTT9k+wNARfJYuLEpOqnW axxDCHA6jsB8j5nxPE3uCbG2ICPQV6whjfJYo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FVTuUgZ01YXadVlQNhQr7mpUWbZJ7nrRUcoMljAwu28=; b=bQ1hVNA5c+M/TxYGKT5LxLiDI0oFGjpQrieJTXx+7uvIEoXWH7nmog1jLl/uwpCuN3 06izN/jfMyxgnLlfinyhw6p7vF9dtO9LXfqKxbXlXvG8B96Uf+8ZhgSxdEaXiqHrmljh fdxK9ViOi25P8+lxCRxETLcEt+8QENA9urNfzhR3oJA7n3m5xaYL0k047e8UFUITts6b eMpOYy20h5CITpGSjMPuSGJV/br7Q94HAPqhHLa9aV90oNq4wFhfhPTosjIsRLNWTMRH 0RbYTodk2kvihVL2Xp5MVVG9NZuumACz615HJwGTaZ+PCDEobWSPhBcHfu0fidL9UYpl r9NQ== X-Gm-Message-State: APjAAAXORuDV3jXMZiIamvgpdp8uZ9eLCdG9OoRPGiDkBdto0je2zTEG Qxx1YNcKHXJXh2xrw6rS+E0wyA== X-Received: by 2002:a05:6214:242:: with SMTP id k2mr17039582qvt.168.1557062992107; Sun, 05 May 2019 06:29:52 -0700 (PDT) Received: from localhost (c-73-216-90-110.hsd1.va.comcast.net. [73.216.90.110]) by smtp.gmail.com with ESMTPSA id k53sm4815370qtb.65.2019.05.05.06.29.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 May 2019 06:29:51 -0700 (PDT) Date: Sun, 5 May 2019 13:29:49 +0000 From: Joel Fernandes To: Qais Yousef Cc: linux-kernel@vger.kernel.org, Michal Gregorczyk , Adrian Ratiu , Mohammad Husain , Srinivas Ramana , duyuchao , Manjo Raja Rao , Karim Yaghmour , Tamir Carmeli , Yonghong Song , Alexei Starovoitov , Brendan Gregg , Masami Hiramatsu , Peter Ziljstra , Steven Rostedt , Kees Cook , kernel-team@android.com, Daniel Borkmann , Ingo Molnar , netdev@vger.kernel.org Subject: Re: [PATCH RFC] bpf: Add support for reading user pointers Message-ID: <20190505132949.GB3076@localhost> References: <20190502204958.7868-1-joel@joelfernandes.org> <20190503121234.6don256zuvfjtdg6@e107158-lin.cambridge.arm.com> <20190503134935.GA253329@google.com> <20190505110423.u7g3f2viovvgzbtn@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190505110423.u7g3f2viovvgzbtn@e107158-lin.cambridge.arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 05, 2019 at 12:04:24PM +0100, Qais Yousef wrote: > On 05/03/19 09:49, Joel Fernandes wrote: > > On Fri, May 03, 2019 at 01:12:34PM +0100, Qais Yousef wrote: > > > Hi Joel > > > > > > On 05/02/19 16:49, Joel Fernandes (Google) wrote: > > > > The eBPF based opensnoop tool fails to read the file path string passed > > > > to the do_sys_open function. This is because it is a pointer to > > > > userspace address and causes an -EFAULT when read with > > > > probe_kernel_read. This is not an issue when running the tool on x86 but > > > > is an issue on arm64. This patch adds a new bpf function call based > > > > > > I just did an experiment and if I use Android 4.9 kernel I indeed fail to see > > > PATH info when running opensnoop. But if I run on 5.1-rc7 opensnoop behaves > > > correctly on arm64. > > > > > > My guess either a limitation that was fixed on later kernel versions or Android > > > kernel has some strict option/modifications that make this fail? > > > > Thanks a lot for checking, yes I was testing 4.9 kernel with this patch (pixel 3). > > > > I am not sure what has changed since then, but I still think it is a good > > idea to make the code more robust against such future issues anyway. In > > particular, we learnt with extensive discussions that user/kernel pointers > > are not necessarily distinguishable purely based on their address. > > Yes I wasn't arguing against that. But the commit message is misleading or > needs more explanation at least. I tried 4.9.y stable and arm64 worked on that > too. Why do you think it's an arm64 problem? Well it is broken on at least on at least one arm64 device and the patch I sent fixes it. We know that the bpf is using wrong kernel API so why not fix it? Are you saying we should not fix it like in this patch? Or do you have another fix in mind? thanks. > > -- > Qais Yousef