Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754257AbcJZHWx convert rfc822-to-8bit (ORCPT ); Wed, 26 Oct 2016 03:22:53 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:56140 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbcJZHWv (ORCPT ); Wed, 26 Oct 2016 03:22:51 -0400 From: Arnd Bergmann To: =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Andy Lutomirski , Daniel Borkmann , Daniel Mack , David Drysdale , "David S . Miller" , "Eric W . Biederman" , James Morris , Jann Horn , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Tejun Heo , Thomas Graf , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [RFC v4 02/18] bpf: Move u64_to_ptr() to BPF headers and inline it Date: Wed, 26 Oct 2016 09:19:08 +0200 Message-ID: <4045933.vGduYR3PCp@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20161026065654.19166-3-mic@digikod.net> References: <20161026065654.19166-1-mic@digikod.net> <20161026065654.19166-3-mic@digikod.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" X-Provags-ID: V03:K0:owZQ4opzCDfL6yAHVy8zrl99Ijg8L4sRni7Guva1sq3MIb0CkNb 84vT1DB7n+pR7h8nNVLfXMTNeUT4OH24b6ZCcxVqF5fr2nFnKDkCUuj3nwvdFG04JLNQVCl kZ4rfeQ6GY6QgkLE2IsduOKc3fPTGyNCwQZjc1b12/ZT9I8DWXcWKoW4h6iKMUF20Hue6DL Lj2ARJvsPlmu3tBuPEr3g== X-UI-Out-Filterresults: notjunk:1;V01:K0:2aefZ4PxsSs=:9kpcJiZABnJ6tQxK5cxSpa ZBcyh9Y/Yg7cseNTG88aSIb1La7b/rD6lkQOIYNVEcnS3C12Nsqfv1hlU9KZVk2QsfuPEuDeE kjh85AF3K1Kb0Xxqos7/pE1xZvDHHliDEvcuXOnI1ejMThQFeN8CbnZdGhKZ+X7MiBCuvQVE4 GcMMMgORJT4ywNPsd32Wf0/PbDcBnCW/EHCGrx4jpRSBjOuWd1xarG2jN73bbTi2K1sIOb8Xi 84P7VMATTqiglw05yJvBMEmFsrgTepM0QVhbdWyewrxChNoVVSF9eX0zIdHKweFA3fuRzSCtg JGdD+eg6PCAXev7TiV9wYmFeue+PTjEDVnPWGXnnxBiwdDKK+2+IqCYhXYaDAmPC9lKV2Ujzo +PFPjiFLSXs81uioypjWRzDD4/16MlaEcTrt8rwI4BH7s58jVuTG1jV1BcLAJxamPJ6mraGJ4 ZYujtPCmMKqLPeYssFcYBh604PU+FcUwX7ikhQFcmBP2q5Y96Z6bZu7E6DxA+XpYuc+TzcZ+J Km4bbsHbYfWSYjQigw1EO3iZLZGGu4ywXvqoO3l6xcAYv/CnrGgByPwHYbz/a57GYST102uoN sWQ8PMrPVTx4e6DoAbZcgLDDJ1g3Qm69usyUfedmPySecjOpAqD6FVOWzxTwwn7t1LMHIcOuo bXLtCLcGDZSH8unLTBFZBLtsruOrQ55QUAY0pOxvpkpMlSmYx/trzmI80EocXwFWYIek9wVlH 1hBQ1QHSCiTWD25x Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1335 Lines: 35 On Wednesday, October 26, 2016 8:56:38 AM CEST Micka?l Sala?n wrote: > include/linux/bpf.h | 6 ++++++ > kernel/bpf/syscall.c | 6 ------ > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h > index c201017b5730..cf87db6daf27 100644 > --- a/include/linux/bpf.h > +++ b/include/linux/bpf.h > @@ -283,6 +283,12 @@ static inline void bpf_long_memcpy(void *dst, const void *src, u32 size) > > /* verify correctness of eBPF program */ > int bpf_check(struct bpf_prog **fp, union bpf_attr *attr); > + > +/* helper to convert user pointers passed inside __aligned_u64 fields */ > +static inline void __user *u64_to_ptr(__u64 val) > +{ > + return (void __user *) (unsigned long) val; > +} > #else > We already have at least six copies of this helper: fs/btrfs/qgroup.c:#define u64_to_ptr(x) ((struct btrfs_qgroup *)(uintptr_t)x) kernel/bpf/syscall.c:static void __user *u64_to_ptr(__u64 val) drivers/staging/android/ion/ion_test.c:#define u64_to_uptr(x) ((void __user *)(unsigned long)(x)) drivers/firewire/core-cdev.c:static void __user *u64_to_uptr(u64 value) drivers/staging/android/ion/ion_test.c:#define u64_to_uptr(x) ((void __user *)(unsigned long)(x)) include/linux/kernel.h:#define u64_to_user_ptr(x) ( \ Just use the one in linux/kernel.h Arnd