Re: [PATCH v5 1/9] lib: zstd: Add zstd compatibility wrapper

2020-11-16 Thread Christoph Hellwig
On Tue, Nov 10, 2020 at 02:24:35PM -0500, Chris Mason wrote: > I think APIs change based on the needs of the project. We do this all the > time in the kernel, and we don???t think twice about updating users of the > API as needed. We update kernel APIs when: - we need additional functionality

Re: [PATCH v5 1/9] lib: zstd: Add zstd compatibility wrapper

2020-11-10 Thread Christoph Hellwig
On Mon, Nov 09, 2020 at 02:01:41PM -0500, Chris Mason wrote: > You do consistently ask for a shim layer, but you haven???t explained what > we gain by diverging from the documented and tested API of the upstream zstd > project. It???s an important discussion given that we hope to regularly > updat

Re: [PATCH v5 1/9] lib: zstd: Add zstd compatibility wrapper

2020-11-06 Thread Christoph Hellwig
You just keep resedning this crap, don't you? Haven't you been told multiple times to provide a proper kernel API by now? On Mon, Nov 02, 2020 at 10:05:27PM -0800, Nick Terrell wrote: > From: Nick Terrell > > Adds zstd_compat.h which provides the necessary functions from the > current zstd.h AP

Re: [PATCH] crypto: jitterentropy - bind statically into kernel

2020-10-04 Thread Christoph Hellwig
On Mon, Oct 05, 2020 at 08:44:39AM +0200, Ard Biesheuvel wrote: > On Mon, 5 Oct 2020 at 08:40, Stephan Mueller wrote: > > > > Am Montag, 5. Oktober 2020, 08:24:46 CEST schrieb Ard Biesheuvel: > > > > Hi Ard, > > > > > If jitterentropy is a special case, we could put a alternate > > > non-'static i

Re: [PATCH] crypto: jitterentropy - bind statically into kernel

2020-10-04 Thread Christoph Hellwig
[adding Thomas] On Mon, Oct 05, 2020 at 08:40:25AM +0200, Stephan Mueller wrote: > > If jitterentropy is a special case, we could put a alternate > > non-'static inline' version of random_get_entropy() in the core > > kernel, and only export it if JITTER_ENTROPY is built as a module in > > the fir

Re: [PATCH] crypto: jitterentropy - bind statically into kernel

2020-10-04 Thread Christoph Hellwig
On Sun, Oct 04, 2020 at 11:16:10PM +0200, Ard Biesheuvel wrote: > On Sun, 4 Oct 2020 at 20:48, Stephan M??ller wrote: > > > > The RISC-V architecture is about to implement the callback > > random_get_entropy with a function that is not exported to modules. > > Why is that? Wouldn't it be better t

Re: [GIT PULL][PATCH v4 0/9] Update to zstd-1.4.6

2020-10-01 Thread Christoph Hellwig
On Thu, Oct 01, 2020 at 06:35:34PM +, Nick Terrell wrote: > I???m open to suggestions on how to get a zstd update done better. I don???t > know of any way to break this patch up into smaller patches that all compile. > The code is all generated directly from upstream and modified to work in the

Re: [PATCH v4 0/9] Update to zstd-1.4.6

2020-10-01 Thread Christoph Hellwig
On Wed, Sep 30, 2020 at 08:05:45PM +, Nick Terrell wrote: > > > > On Sep 29, 2020, at 11:53 PM, Christoph Hellwig wrote: > > > > As you keep resend this I keep retelling you that should not do it. > > Please provide a proper Linux API, and switch to

get_cycles from modular code in jitterentropy, was Re: [PATCH] clocksource: clint: Export clint_time_val for modules

2020-10-01 Thread Christoph Hellwig
On Tue, Sep 29, 2020 at 11:56:18PM -0700, Palmer Dabbelt wrote: > clint_time_val will soon be used by the RISC-V implementation of > random_get_entropy(), which is a static inline function that may be used by > modules (at least CRYPTO_JITTERENTROPY=m). At very least this needs to be an EXPORT_SYM

Re: [PATCH v4 0/9] Update to zstd-1.4.6

2020-09-29 Thread Christoph Hellwig
As you keep resend this I keep retelling you that should not do it. Please provide a proper Linux API, and switch to that. Versioned APIs have absolutely no business in the Linux kernel. On Tue, Sep 29, 2020 at 11:53:09PM -0700, Nick Terrell wrote: > From: Nick Terrell > > This patchset upgrade

Re: [PATCH] crypto: sa2ul: Fix DMA mapping API usage

2020-09-22 Thread Christoph Hellwig
On Mon, Sep 21, 2020 at 02:38:46PM +0300, Peter Ujfalusi wrote: > Make sure that we call the dma_unmap_sg on the correct scatterlist on > completion with the correct sg_nents. > > We also should be calling dma_sync_sg_for_device() on the tx buffer before > giving it to the DMA and the dma_sync_sg_

Re: [PATCH v2 0/9] Update to zstd-1.4.6

2020-09-22 Thread Christoph Hellwig
FYI, as mentioned last time: clear NAK for letting these bad APIs slip into the overall kernel code. Please provide proper kernel style wrappers to avoid these kinds of updates and in the future just change APIs on an as-needed basis.

Re: [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-17 Thread Christoph Hellwig
On Wed, Sep 16, 2020 at 09:35:51PM -0400, Rik van Riel wrote: > > One possibility is to have a kernel wrapper on top of the zstd API to > > make it > > more ergonomic. I personally don???t really see the value in it, since > > it adds > > another layer of indirection between zstd and the caller, bu

Re: [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Wed, Sep 16, 2020 at 10:43:04AM -0400, Chris Mason wrote: > Otherwise we just end up with drift and kernel-specific bugs that are harder > to debug. To the extent those APIs make us contort the kernel code, I???m > sure Nick is interested in improving things in both places. Seriously, we do no

Re: [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Wed, Sep 16, 2020 at 10:20:52AM -0400, Chris Mason wrote: > It???s not completely clear what you???re asking for here. If the API > matches what???s in zstd-1.4.6, that seems like a reasonable way to label > it. That???s what the upstream is for this code. > > I???m also not sure why we???re

Re: [PATCH 5/9] btrfs: zstd: Switch to the zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
On Tue, Sep 15, 2020 at 08:42:59PM -0700, Nick Terrell wrote: > From: Nick Terrell > > Move away from the compatibility wrapper to the zstd-1.4.6 API. This > code is functionally equivalent. Again, please use sensible names And no one gives a fuck if this bad API is "zstd-1.4.6" as the Linux ke

Re: [PATCH 1/9] lib: zstd: Add zstd compatibility wrapper

2020-09-16 Thread Christoph Hellwig
On Tue, Sep 15, 2020 at 08:42:54PM -0700, Nick Terrell wrote: > From: Nick Terrell > > Adds zstd_compat.h which provides the necessary functions from the > current zstd.h API. It is only active for zstd versions 1.4.6 and newer. > That means it is disabled currently, but will become active when a

Re: [PATCH 4/9] crypto: zstd: Switch to zstd-1.4.6 API

2020-09-16 Thread Christoph Hellwig
> + const size_t wksp_size = ZSTD_estimateCCtxSize(ZSTD_DEF_LEVEL); > + > + if (ZSTD_isError(wksp_size)) { > + ret = -EINVAL; > + goto out_free; > + } Pleas switch to properly named functions when you touch this. The API names here look like a cat threw up on t

Re: [PATCH 25/26] net: pass a sockptr_t into ->setsockopt

2020-08-07 Thread Christoph Hellwig
On Thu, Aug 06, 2020 at 03:21:25PM -0700, Eric Dumazet wrote: > converting get_user(...) to copy_from_sockptr(...) really assumed the > optlen > has been validated to be >= sizeof(int) earlier. > > Which is not always the case, for example here. Yes. And besides the bpfilter mess the main re

Re: [RFC PATCH 00/17] Drop uses of pci_read_config_*() return value

2020-08-02 Thread Christoph Hellwig
On Sun, Aug 02, 2020 at 02:14:06PM -0500, Bjorn Helgaas wrote: > But what guarantees that a PCI config register cannot contain ~0? > If there's something about that in the spec I'd love to know where it > is because it would simplify a lot of things. There isn't. An we even have cases like the NV

Re: [PATCH 12/26] netfilter: switch nf_setsockopt to sockptr_t

2020-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2020 at 06:16:32PM +0200, Jason A. Donenfeld wrote: > Maybe sockptr_advance should have some safety checks and sometimes > return -EFAULT? Or you should always use the implementation where > being a kernel address is an explicit bit of sockptr_t, rather than > being implicit? I alr

Re: [PATCH 12/26] netfilter: switch nf_setsockopt to sockptr_t

2020-07-27 Thread Christoph Hellwig
Can you try the patch below? --- >From cce2d2e1b43ecee5f4af7cf116808b74b330080f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 27 Jul 2020 17:42:27 +0200 Subject: net: remove sockptr_advance sockptr_advance never properly worked. Replace it with _offset variants

Re: [PATCH 19/26] net/ipv6: switch ipv6_flowlabel_opt to sockptr_t

2020-07-27 Thread Christoph Hellwig
I have to admit I didn't spot the difference between the good and the bad output even after trying hard.. But can you try the patch below? --- >From cce2d2e1b43ecee5f4af7cf116808b74b330080f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 27 Jul 2020 17:42:27 +0200 Subj

Re: [PATCH 12/26] netfilter: switch nf_setsockopt to sockptr_t

2020-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2020 at 05:03:10PM +0200, Jason A. Donenfeld wrote: > Hi Christoph, > > On Thu, Jul 23, 2020 at 08:08:54AM +0200, Christoph Hellwig wrote: > > diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c > > index da933f99b5d517..42befbf12846c0 1006

Re: [PATCH 19/26] net/ipv6: switch ipv6_flowlabel_opt to sockptr_t

2020-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2020 at 03:15:05PM +0300, Ido Schimmel wrote: > I see a regression with IPv6 flowlabel that I bisected to this patch. > When passing '-F 0' to 'ping' the flow label should be random, yet it's > the same every time after this patch. Can you send a reproducer? > > It seems that the

Re: get rid of the address_space override in setsockopt v2

2020-07-26 Thread Christoph Hellwig
push this out when > that is done. The buildbot found one warning with the isdn debug code after a few days, here is what I think is the best fix: --- >From 6601732f7a54db5f04efba08f7e9224e5b757112 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 26 Jul 2020 09:00:09

Re: [PATCH 04/26] net: add a new sockptr_t type

2020-07-23 Thread Christoph Hellwig
On Thu, Jul 23, 2020 at 09:40:27AM -0700, Eric Dumazet wrote: > I am not sure why you chose sockptr_t for something that really seems > generic. > > Or is it really meant to be exclusive to setsockopt() and/or getsockopt() ? > > If the first user of this had been futex code, we would have used

Re: [PATCH 03/26] bpfilter: reject kernel addresses

2020-07-23 Thread 'Christoph Hellwig'
On Thu, Jul 23, 2020 at 02:42:11PM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 23 July 2020 07:09 > > > > The bpfilter user mode helper processes the optval address using > > process_vm_readv. Don't send it kernel addresses fed under > >

Re: [PATCH 13/26] bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t

2020-07-23 Thread 'Christoph Hellwig'
On Thu, Jul 23, 2020 at 11:16:16AM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 23 July 2020 07:09 > > > > This is mostly to prepare for cleaning up the callers, as bpfilter by > > design can't handle kernel pointers. > > You've f

get rid of the address_space override in setsockopt v2

2020-07-22 Thread Christoph Hellwig
Hi Dave, setsockopt is the last place in architecture-independ code that still uses set_fs to force the uaccess routines to operate on kernel pointers. This series adds a new sockptr_t type that can contained either a kernel or user pointer, and which has accessors that do the right thing, and th

[PATCH 05/26] net: switch copy_bpf_fprog_from_user to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/filter.h | 3 ++- net/core/filter.c | 6 +++--- net/core/sock.c| 6 -- net/packet/af_packet.c | 4 ++-- 4 files changed, 11 insertions

[PATCH 03/26] bpfilter: reject kernel addresses

2020-07-22 Thread Christoph Hellwig
The bpfilter user mode helper processes the optval address using process_vm_readv. Don't send it kernel addresses fed under set_fs(KERNEL_DS) as that won't work. Signed-off-by: Christoph Hellwig --- net/bpfilter/bpfilter_kern.c | 4 1 file changed, 4 insertions(+) diff -

[PATCH 02/26] net/bpfilter: split __bpfilter_process_sockopt

2020-07-22 Thread Christoph Hellwig
Split __bpfilter_process_sockopt into a low-level send request routine and the actual setsockopt hook to split the init time ping from the actual setsockopt processing. Signed-off-by: Christoph Hellwig --- net/bpfilter/bpfilter_kern.c | 51 +++- 1 file changed

[PATCH 04/26] net: add a new sockptr_t type

2020-07-22 Thread Christoph Hellwig
Add a uptr_t type that can hold a pointer to either a user or kernel memory region, and simply helpers to copy to and from it. Signed-off-by: Christoph Hellwig --- include/linux/sockptr.h | 104 1 file changed, 104 insertions(+) create mode 100644

[PATCH 01/26] bpfilter: fix up a sparse annotation

2020-07-22 Thread Christoph Hellwig
The __user doesn't make sense when casting to an integer type, just switch to a uintptr_t cast which also removes the need for the __force. Signed-off-by: Christoph Hellwig --- net/bpfilter/bpfilter_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bpf

[PATCH 07/26] net: switch sock_set_timeout to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/core/sock.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 5b55bc9397f282

[PATCH 08/26] net: switch sock_set_timeout to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/sock.h | 3 ++- net/core/sock.c | 26 -- net/mptcp/protocol.c | 6 -- net/socket.c | 3 ++- 4 files changed

[PATCH 10/26] netfilter: remove the unused user argument to do_update_counters

2020-07-22 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- net/bridge/netfilter/ebtables.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index fe13108af1f542..12f8929667bf43 100644 --- a/net/bridge/netfilter/ebtables.c

[PATCH 09/26] net/xfrm: switch xfrm_user_policy to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/xfrm.h | 8 +--- net/ipv4/ip_sockglue.c | 3 ++- net/ipv6/ipv6_sockglue.c | 3 ++- net/xfrm/xfrm_state.c| 6 +++--- 4 files changed, 12

[PATCH 14/26] net/ipv4: switch ip_mroute_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/mroute.h | 5 +++-- net/ipv4/ip_sockglue.c | 3 ++- net/ipv4/ipmr.c| 14 +++--- 3 files changed, 12 insertions(+), 10 deletions

[PATCH 18/26] net/ipv6: split up ipv6_flowlabel_opt

2020-07-22 Thread Christoph Hellwig
Split ipv6_flowlabel_opt into a subfunction for each action and a small wrapper. Signed-off-by: Christoph Hellwig --- net/ipv6/ip6_flowlabel.c | 311 +-- 1 file changed, 167 insertions(+), 144 deletions(-) diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6

[PATCH 17/26] net/ipv6: switch ip6_mroute_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/mroute6.h | 8 net/ipv6/ip6mr.c | 17 + net/ipv6/ipv6_sockglue.c | 3 ++- 3 files changed, 15 insertions(+), 13

[PATCH 20/26] net/ipv6: factor out a ipv6_set_opt_hdr helper

2020-07-22 Thread Christoph Hellwig
Factour out a helper to set the IPv6 option headers from do_ipv6_setsockopt. Signed-off-by: Christoph Hellwig --- net/ipv6/ipv6_sockglue.c | 150 +++ 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6

[PATCH 12/26] netfilter: switch nf_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/netfilter.h | 6 -- net/bridge/netfilter/ebtables.c | 37 +++-- net/decnet/af_decnet.c | 3 ++- net

[PATCH 16/26] net/ipv4: switch do_ip_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv4/ip_sockglue.c | 68 -- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/net/ipv4/ip_sockglue.c b/net

[PATCH 11/26] netfilter: switch xt_copy_counters to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/netfilter/x_tables.h | 4 ++-- net/ipv4/netfilter/arp_tables.c| 7 +++ net/ipv4/netfilter/ip_tables.c | 7 +++ net/ipv6/netfilter

[PATCH 13/26] bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
This is mostly to prepare for cleaning up the callers, as bpfilter by design can't handle kernel pointers. Signed-off-by: Christoph Hellwig --- include/linux/bpfilter.h | 6 +++--- net/bpfilter/bpfilter_kern.c | 6 +++--- net/ipv4/bpfilter/sockopt.c | 8 net/ipv4/ip_sockg

[PATCH 19/26] net/ipv6: switch ipv6_flowlabel_opt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Note that the get case is pretty weird in that it actually copies data back to userspace from setsockopt. Signed-off-by: Christoph Hellwig --- include/net/ipv6.h | 2 +- net/ipv6/ip6_flowlabel.c

[PATCH 15/26] net/ipv4: merge ip_options_get and ip_options_get_from_user

2020-07-22 Thread Christoph Hellwig
Use the sockptr_t type to merge the versions. Signed-off-by: Christoph Hellwig --- include/net/ip.h | 5 ++--- net/ipv4/ip_options.c | 43 +++--- net/ipv4/ip_sockglue.c | 7 --- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a

[PATCH 24/26] net/tcp: switch do_tcp_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv4/tcp.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index

[PATCH 22/26] net/udp: switch udp_lib_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/udp.h | 2 +- net/ipv4/udp.c| 7 --- net/ipv6/udp.c| 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/net/udp.h b

[PATCH 21/26] net/ipv6: switch do_ipv6_setsockopt to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv6/ipv6_sockglue.c | 66 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/net/ipv6/ipv6_sockglue.c b/net

[PATCH 23/26] net/tcp: switch ->md5_parse to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/tcp.h | 2 +- net/ipv4/tcp.c | 3 ++- net/ipv4/tcp_ipv4.c | 4 ++-- net/ipv6/tcp_ipv6.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions

[PATCH 25/26] net: pass a sockptr_t into ->setsockopt

2020-07-22 Thread Christoph Hellwig
Rework the remaining setsockopt code to pass a sockptr_t instead of a plain user pointer. This removes the last remaining set_fs(KERNEL_DS) outside of architecture specific code. Signed-off-by: Christoph Hellwig Acked-by: Stefan Schmidt [ieee802154] --- crypto/af_alg.c

[PATCH 26/26] net: optimize the sockptr_t for unified kernel/user address spaces

2020-07-22 Thread Christoph Hellwig
ed to check that users don't pass in kernel address and thus gain access to kernel memory. Thus the USER_SOCKPTR helper is replaced with a init_user_sockptr function that does this check and returns an error if it fails. Signed-off-by: Christoph Hellwig --- include/linux/sockptr.

[PATCH 06/26] net: switch sock_setbindtodevice to sockptr_t

2020-07-22 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/core/sock.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 71fc7e4ddd0648..5b55bc9397f282

Re: get rid of the address_space override in setsockopt

2020-07-22 Thread 'Christoph Hellwig'
On Tue, Jul 21, 2020 at 10:26:58AM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 20 July 2020 13:47 > > > > setsockopt is the last place in architecture-independ code that still > > uses set_fs to force the uaccess routines to operate on kernel pointers

Re: get rid of the address_space override in setsockopt

2020-07-22 Thread 'Christoph Hellwig'
On Tue, Jul 21, 2020 at 09:38:23AM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 20 July 2020 13:47 > > > > setsockopt is the last place in architecture-independ code that still > > uses set_fs to force the uaccess routines to operate on kernel pointers

Re: [PATCH 12/24] bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t

2020-07-22 Thread 'Christoph Hellwig'
On Wed, Jul 22, 2020 at 10:00:23AM +0200, 'Christoph Hellwig' wrote: > On Tue, Jul 21, 2020 at 08:36:57AM +, David Laight wrote: > > From: Christoph Hellwig > > > Sent: 20 July 2020 13:47 > > > > > > This is mostly to prepare for cleaning up

Re: [PATCH 12/24] bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t

2020-07-22 Thread 'Christoph Hellwig'
On Tue, Jul 21, 2020 at 08:36:57AM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 20 July 2020 13:47 > > > > This is mostly to prepare for cleaning up the callers, as bpfilter by > > design can't handle kernel pointers. > ^^

Re: get rid of the address_space override in setsockopt

2020-07-22 Thread Christoph Hellwig
On Mon, Jul 20, 2020 at 01:47:56PM -0700, Alexei Starovoitov wrote: > > a kernel pointer. This is something that works for most common sockopts > > (and is something that the ePBF support relies on), but unfortunately > > in various corner cases we either don't use the passed in length, or in > >

Re: [PATCH 03/24] net: add a new sockptr_t type

2020-07-22 Thread Christoph Hellwig
On Mon, Jul 20, 2020 at 10:55:43AM -0700, Eric Biggers wrote: > On Mon, Jul 20, 2020 at 07:43:22PM +0200, Christoph Hellwig wrote: > > On Mon, Jul 20, 2020 at 09:37:48AM -0700, Eric Biggers wrote: > > > How does this not introduce a massive

Re: [PATCH 02/24] bpfilter: fix up a sparse annotation

2020-07-20 Thread Christoph Hellwig
On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be

Re: [PATCH 03/24] net: add a new sockptr_t type

2020-07-20 Thread Christoph Hellwig
On Mon, Jul 20, 2020 at 09:37:48AM -0700, Eric Biggers wrote: > How does this not introduce a massive security hole when > CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE? > > AFAICS, userspace can pass in a pointer >= TASK_SIZE, > and this code makes it be treated as a kernel pointer. Yeah, we'll

Re: get rid of the address_space override in setsockopt

2020-07-20 Thread Christoph Hellwig
On Mon, Jul 20, 2020 at 09:38:36AM -0700, Eric Biggers wrote: > Please mention what git tree your patchset applies to. net-next/master

[PATCH 01/24] bpfilter: reject kernel addresses

2020-07-20 Thread Christoph Hellwig
When feeding addresses to userspace we can't support kernel addresses that were fed under set_fs(KERNEL_DS) from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/bpfilter/bpfilter_kern.c | 5 + 1 file changed, 5 insertions(+) diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpf

[PATCH 04/24] net: switch copy_bpf_fprog_from_user to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/filter.h | 3 ++- net/core/filter.c | 6 +++--- net/core/sock.c| 6 -- net/packet/af_packet.c | 4 ++-- 4 files changed, 11 insertions

[PATCH 03/24] net: add a new sockptr_t type

2020-07-20 Thread Christoph Hellwig
architectures with overlapping address spaces a flag to indicate the address space is used instead. Signed-off-by: Christoph Hellwig --- include/linux/sockptr.h | 121 1 file changed, 121 insertions(+) create mode 100644 include/linux/sockptr.h diff --git

[PATCH 05/24] net: switch sock_setbindtodevice to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/core/sock.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 91224709869389..bd20fc5cce0850

[PATCH 06/24] net: switch sock_set_timeout to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/core/sock.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index bd20fc5cce0850

[PATCH 02/24] bpfilter: fix up a sparse annotation

2020-07-20 Thread Christoph Hellwig
The __user doesn't make sense when casting to an integer type. Signed-off-by: Christoph Hellwig --- net/bpfilter/bpfilter_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c index 977e9dad72ca4f..713b4b3d0

[PATCH 07/24] net: switch sock_set_timeout to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/sock.h | 3 ++- net/core/sock.c | 26 -- net/mptcp/protocol.c | 6 -- net/socket.c | 3 ++- 4 files changed

[PATCH 10/24] netfilter: switch xt_copy_counters to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/netfilter/x_tables.h | 4 ++-- net/ipv4/netfilter/arp_tables.c| 7 +++ net/ipv4/netfilter/ip_tables.c | 7 +++ net/ipv6/netfilter

[PATCH 09/24] netfilter: remove the unused user argument to do_update_counters

2020-07-20 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- net/bridge/netfilter/ebtables.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index fe13108af1f542..12f8929667bf43 100644 --- a/net/bridge/netfilter/ebtables.c

[PATCH 08/24] net/xfrm: switch xfrm_user_policy to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/xfrm.h | 8 +--- net/ipv4/ip_sockglue.c | 3 ++- net/ipv6/ipv6_sockglue.c | 3 ++- net/xfrm/xfrm_state.c| 6 +++--- 4 files changed, 12

[PATCH 11/24] netfilter: switch nf_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/netfilter.h | 6 -- net/bridge/netfilter/ebtables.c | 37 +++-- net/decnet/af_decnet.c | 3 ++- net

[PATCH 16/24] net/ipv6: switch ip6_mroute_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/mroute6.h | 8 net/ipv6/ip6mr.c | 17 + net/ipv6/ipv6_sockglue.c | 3 ++- 3 files changed, 15 insertions(+), 13

[PATCH 12/24] bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
This is mostly to prepare for cleaning up the callers, as bpfilter by design can't handle kernel pointers. Signed-off-by: Christoph Hellwig --- include/linux/bpfilter.h | 6 +++--- net/bpfilter/bpfilter_kern.c | 8 net/ipv4/bpfilter/sockopt.c | 8 net/ipv4/ip_sockg

[PATCH 14/24] net/ipv4: merge ip_options_get and ip_options_get_from_user

2020-07-20 Thread Christoph Hellwig
Use the sockptr_t type to merge the versions. Signed-off-by: Christoph Hellwig --- include/net/ip.h | 5 ++--- net/ipv4/ip_options.c | 43 +++--- net/ipv4/ip_sockglue.c | 7 --- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a

[PATCH 15/24] net/ipv4: switch do_ip_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv4/ip_sockglue.c | 68 -- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/net/ipv4/ip_sockglue.c b/net

[PATCH 17/24] net/ipv6: split up ipv6_flowlabel_opt

2020-07-20 Thread Christoph Hellwig
Split ipv6_flowlabel_opt into a subfunction for each action and a small wrapper. Signed-off-by: Christoph Hellwig --- net/ipv6/ip6_flowlabel.c | 311 +-- 1 file changed, 167 insertions(+), 144 deletions(-) diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6

[PATCH 13/24] net/ipv4: switch ip_mroute_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/linux/mroute.h | 5 +++-- net/ipv4/ip_sockglue.c | 3 ++- net/ipv4/ipmr.c| 14 +++--- 3 files changed, 12 insertions(+), 10 deletions

[PATCH 23/24] net/tcp: switch do_tcp_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv4/tcp.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index

[PATCH 24/24] net: pass a sockptr_t into ->setsockopt

2020-07-20 Thread Christoph Hellwig
Rework the remaining setsockopt code to pass a sockptr_t instead of a plain user pointer. This removes the last remaining set_fs(KERNEL_DS) outside of architecture specific code. Signed-off-by: Christoph Hellwig --- crypto/af_alg.c | 7 ++-- drivers/crypto/chelsio

[PATCH 18/24] net/ipv6: switch ipv6_flowlabel_opt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Note that the get case is pretty weird in that it actually copies data back to userspace from setsockopt. Signed-off-by: Christoph Hellwig --- include/net/ipv6.h | 2 +- net/ipv6/ip6_flowlabel.c

[PATCH 22/24] net/tcp: switch ->md5_parse to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/tcp.h | 2 +- net/ipv4/tcp.c | 3 ++- net/ipv4/tcp_ipv4.c | 4 ++-- net/ipv6/tcp_ipv6.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions

[PATCH 21/24] net/udp: switch udp_lib_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- include/net/udp.h | 2 +- net/ipv4/udp.c| 7 --- net/ipv6/udp.c| 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/net/udp.h b

get rid of the address_space override in setsockopt

2020-07-20 Thread Christoph Hellwig
Hi Dave, setsockopt is the last place in architecture-independ code that still uses set_fs to force the uaccess routines to operate on kernel pointers. This series adds a new sockptr_t type that can contained either a kernel or user pointer, and which has accessors that do the right thing, and th

[PATCH 19/24] net/ipv6: factor out a ipv6_set_opt_hdr helper

2020-07-20 Thread Christoph Hellwig
Factour out a helper to set the IPv6 option headers from do_ipv6_setsockopt. Signed-off-by: Christoph Hellwig --- net/ipv6/ipv6_sockglue.c | 150 +++ 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6

[PATCH 20/24] net/ipv6: switch do_ipv6_setsockopt to sockptr_t

2020-07-20 Thread Christoph Hellwig
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig --- net/ipv6/ipv6_sockglue.c | 66 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/net/ipv6/ipv6_sockglue.c b/net

Re: [PATCH 0/5] vfio/pci: add blocklist and disable qat

2020-07-10 Thread Christoph Hellwig
On Wed, Jul 01, 2020 at 01:42:09PM +0100, Christoph Hellwig wrote: > On Wed, Jul 01, 2020 at 12:02:57PM +0100, Giovanni Cabiddu wrote: > > This patchset defines a blocklist of devices in the vfio-pci module and adds > > the current generation of Intel(R) QuickAssist devices to

Re: [PATCH 0/5] vfio/pci: add blocklist and disable qat

2020-07-01 Thread Christoph Hellwig
On Wed, Jul 01, 2020 at 12:02:57PM +0100, Giovanni Cabiddu wrote: > This patchset defines a blocklist of devices in the vfio-pci module and adds > the current generation of Intel(R) QuickAssist devices to it as they are > not designed to run in an untrusted environment. How can they not be safe?

Re: [PATCH 1/2] PCI: Introduce PCI_FIXUP_IOMMU

2020-05-26 Thread Christoph Hellwig
On Tue, May 26, 2020 at 07:49:08PM +0800, Zhangfei Gao wrote: > Some platform devices appear as PCI but are actually on the AMBA bus, > and they need fixup in drivers/pci/quirks.c handling iommu_fwnode. > Here introducing PCI_FIXUP_IOMMU, which is called after iommu_fwnode > is allocated, instead o

Re: [RFT PATCH 0/3] crypto: sparc - convert to skcipher API

2019-10-15 Thread Christoph Hellwig
On Fri, Oct 11, 2019 at 09:38:47PM -0700, Eric Biggers wrote: > This series converts the glue code for the SPARC64 crypto opcodes > implementations of AES, Camellia, DES, and 3DES modes from the > deprecated "blkcipher" API to the "skcipher" API. This is needed in > order for the blkcipher API to

Re: [PATCH] crypto: caam - fix zero-length buffer DMA mapping

2018-12-19 Thread Christoph Hellwig
Yes, we should never do zero-length dma mappings, so this looks good: Reviewed-by: Christoph Hellwig

Re: [PATCH] scatterlist: Update size type to support greater then 4GB size.

2018-12-12 Thread Christoph Hellwig
scatterlist elements longer than 4GB sound odd. Please submit it in a series with your actual user so that we can help figuring out if it really makes sense or if there is a better way to solve your problem. As is this patch will massively increase the memory usage for all users of struct scatter

Re: [PATCH] Performance Improvement in CRC16 Calculations.

2018-08-21 Thread Christoph Hellwig
On Tue, Aug 21, 2018 at 09:40:34PM -0400, Martin K. Petersen wrote: > When crc-t10dif is initialized, the crypto infrastructure will pick the > algorithm with the highest priority currently registered. Both block and > SCSI will cause crc-t10dif to be compiled as a built-in so this > selection happ

Re: [PATCH] crypto: marvell/cesa - Fix DMA API misuse

2018-01-10 Thread Christoph Hellwig
On Wed, Jan 10, 2018 at 04:25:22PM +0100, Boris Brezillon wrote: > On Wed, 10 Jan 2018 15:15:43 + > Robin Murphy wrote: > > > phys_to_dma() is an internal helper for certain DMA API implementations, > > and is not appropriate for drivers to use. It appears that what the CESA > > driver really

Re: [Part2 PATCH v4.1 07/29] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support

2017-10-04 Thread Christoph Hellwig
On Wed, Oct 04, 2017 at 11:21:53AM +0200, Borislav Petkov wrote: > On Wed, Oct 04, 2017 at 12:26:11PM +0530, P J P wrote: > > Each return above needs to be on its own line. > > ... because? It's actually readable by humanѕ that way.

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-10-01 Thread Christoph Hellwig
On Wed, Sep 27, 2017 at 10:13:51AM -0700, Dan Williams wrote: > As far as I can see "Offset can be greater than PAGE_SIZE" is the only > safe assumption for core code. It seems completely bogus to me, but if it is the current assumption we'll have to document it. But this brings me back to that o

  1   2   >