Re: [PATCH kernel] powerpc/dma: Fix dma_map_ops::get_required_mask

2020-09-24 Thread Christoph Hellwig
On Thu, Sep 24, 2020 at 05:03:11PM +1000, Alexey Kardashevskiy wrote: > May be... The current behavior is not wrong (after the fix) but not > optimal either. Even with legacy PCI it should just result in failing > attempt to set 64bit mask which drivers should still handle, i.e. choose > a shorter

[PATCH 1/9] compat.h: fix a spelling error in

2020-09-24 Thread Christoph Hellwig
There is no compat_sys_readv64v2 syscall, only a compat_sys_preadv64v2 one. Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index b354ce58966e2d..654c1ec36671a4 100644

[PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c

2020-09-24 Thread Christoph Hellwig
From: David Laight This lets the compiler inline it into import_iovec() generating much better code. Signed-off-by: David Laight Signed-off-by: Christoph Hellwig --- fs/read_write.c | 179 lib/iov_iter.c | 176

[PATCH 3/9] iov_iter: refactor rw_copy_check_uvector and import_iovec

2020-09-24 Thread Christoph Hellwig
of a single loop there now are two loops over the iovecs. Given that the iovecs are cache hot this doesn't make a major difference Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 6 - include/linux/fs.h | 13 -- include/linux/uio.h| 12 +- lib/iov_iter.c | 300

[PATCH 9/9] security/keys: remove compat_keyctl_instantiate_key_iov

2020-09-24 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native version of keyctl_instantiate_key_iov can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- security/keys/compat.c | 36 ++-- security/keys/internal.h | 5 - security/keys

let import_iovec deal with compat_iovecs as well v4

2020-09-24 Thread Christoph Hellwig
Hi Al, this series changes import_iovec to transparently deal with compat iovec structures, and then cleanups up a lot of code dupliation. Changes since v3: - fix up changed prototypes in compat.h as well Changes since v2: - revert the switch of the access process vm sysclls to iov_iter -

[PATCH 7/9] fs: remove compat_sys_vmsplice

2020-09-24 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native vmsplice syscall can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 2 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls

[PATCH 5/9] fs: remove various compat readv/writev helpers

2020-09-24 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs as well, all the duplicated code in the compat readv/writev helpers is not needed. Remove them and switch the compat syscall handlers to use the native helpers. Signed-off-by: Christoph Hellwig --- fs/read_write.c| 179

[PATCH 6/9] fs: remove the compat readv/writev syscalls

2020-09-24 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native readv and writev syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 ++-- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 ++-- arch/mips

[PATCH 8/9] mm: remove compat_process_vm_{readv,writev}

2020-09-24 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 +- arch/mips/kernel/syscalls/syscall_o32.tbl

[PATCH 4/9] iov_iter: transparently handle compat iovecs in import_iovec

2020-09-24 Thread Christoph Hellwig
-by: Christoph Hellwig --- block/scsi_ioctl.c | 12 ++-- drivers/scsi/sg.c | 9 + fs/aio.c | 8 ++-- fs/io_uring.c | 20 fs/read_write.c| 6 -- fs/splice.c| 2 +- include/linux/uio.h| 8

[PATCH] powerpc: switch 85xx defconfigs from legacy ide to libata

2020-09-23 Thread Christoph Hellwig
Switch the 85xx defconfigs from the soon to be removed legacy ide driver to libata. Signed-off-by: Christoph Hellwig --- arch/powerpc/configs/85xx/mpc85xx_cds_defconfig | 6 +++--- arch/powerpc/configs/85xx/tqm8540_defconfig | 6 +++--- arch/powerpc/configs/85xx/tqm8541_defconfig | 6

Re: [PATCH 5/9] fs: remove various compat readv/writev helpers

2020-09-23 Thread Christoph Hellwig
On Wed, Sep 23, 2020 at 06:05:27PM +0100, Al Viro wrote: > On Wed, Sep 23, 2020 at 05:38:31PM +0100, Al Viro wrote: > > On Wed, Sep 23, 2020 at 03:59:01PM +0100, Al Viro wrote: > > > > > > That's a very good question. But it does not just compile but actually > > > > works. Probably because all

Re: [PATCH 5/9] fs: remove various compat readv/writev helpers

2020-09-23 Thread Christoph Hellwig
On Wed, Sep 23, 2020 at 03:25:49PM +0100, Al Viro wrote: > On Wed, Sep 23, 2020 at 08:05:43AM +0200, Christoph Hellwig wrote: > > COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd, > > - const struct compat_iovec __user *,vec, > > + const struct iovec _

Re: [PATCH kernel] powerpc/dma: Fix dma_map_ops::get_required_mask

2020-09-23 Thread Christoph Hellwig
On Tue, Sep 22, 2020 at 12:26:18PM +1000, Alexey Kardashevskiy wrote: > > Well, the original intent of dma_get_required_mask is to return the > > mask that the driver then uses to figure out what to set, so what aacraid > > does fits that use case. > > What was the original intent exactly? The

[PATCH 4/9] iov_iter: transparently handle compat iovecs in import_iovec

2020-09-23 Thread Christoph Hellwig
-by: Christoph Hellwig --- block/scsi_ioctl.c | 12 ++-- drivers/scsi/sg.c | 9 + fs/aio.c | 8 ++-- fs/io_uring.c | 20 fs/read_write.c| 6 -- fs/splice.c| 2 +- include/linux/uio.h| 8

[PATCH 1/9] compat.h: fix a spelling error in

2020-09-23 Thread Christoph Hellwig
There is no compat_sys_readv64v2 syscall, only a compat_sys_preadv64v2 one. Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index b354ce58966e2d..654c1ec36671a4 100644

[PATCH 5/9] fs: remove various compat readv/writev helpers

2020-09-23 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs as well, all the duplicated code in the compat readv/writev helpers is not needed. Remove them and switch the compat syscall handlers to use the native helpers. Signed-off-by: Christoph Hellwig --- fs/read_write.c | 179

[PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c

2020-09-23 Thread Christoph Hellwig
From: David Laight This lets the compiler inline it into import_iovec() generating much better code. Signed-off-by: David Laight Signed-off-by: Christoph Hellwig --- fs/read_write.c | 179 lib/iov_iter.c | 176

[PATCH 8/9] mm: remove compat_process_vm_{readv,writev}

2020-09-23 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 +- arch/mips/kernel/syscalls/syscall_o32.tbl

let import_iovec deal with compat_iovecs as well v3

2020-09-23 Thread Christoph Hellwig
Hi Al, this series changes import_iovec to transparently deal with comat iovec structures, and then cleanups up a lot of code dupliation. Changes since v2: - revert the switch of the access process vm sysclls to iov_iter - refactor the import_iovec internals differently - switch aio to use

[PATCH 9/9] security/keys: remove compat_keyctl_instantiate_key_iov

2020-09-23 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native version of keyctl_instantiate_key_iov can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- security/keys/compat.c | 36 ++-- security/keys/internal.h | 5 - security/keys

[PATCH 7/9] fs: remove compat_sys_vmsplice

2020-09-23 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native vmsplice syscall can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 2 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls

[PATCH 6/9] fs: remove the compat readv/writev syscalls

2020-09-23 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native readv and writev syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 ++-- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 ++-- arch/mips

[PATCH 3/9] iov_iter: refactor rw_copy_check_uvector and import_iovec

2020-09-23 Thread Christoph Hellwig
of a single loop there now are two loops over the iovecs. Given that the iovecs are cache hot this doesn't make a major difference Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 6 - include/linux/fs.h | 13 -- include/linux/uio.h| 12 +- lib/iov_iter.c | 300

Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Christoph Hellwig
On Mon, Sep 21, 2020 at 04:29:37PM +0100, Al Viro wrote: > On Mon, Sep 21, 2020 at 03:21:35PM +, David Laight wrote: > > > You really don't want to be looping through the array twice. > > Profiles, please. Given that the iov array should be cache hot I'd be surprised to see a huge

[PATCH 10/11] mm: remove compat_process_vm_{readv,writev}

2020-09-21 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 +- arch/mips/kernel/syscalls/syscall_o32.tbl

[PATCH 11/11] security/keys: remove compat_keyctl_instantiate_key_iov

2020-09-21 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native version of keyctl_instantiate_key_iov can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- security/keys/compat.c | 36 ++-- security/keys/internal.h | 5 - security/keys

[PATCH 07/11] fs: remove various compat readv/writev helpers

2020-09-21 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs as well, all the duplicated code in the compat readv/writev helpers is not needed. Remove them and switch the compat syscall handlers to use the native helpers. Signed-off-by: Christoph Hellwig --- fs/read_write.c | 179

[PATCH 09/11] fs: remove compat_sys_vmsplice

2020-09-21 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native vmsplice syscall can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 2 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls

[PATCH 08/11] fs: remove the compat readv/writev syscalls

2020-09-21 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native readv and writev syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 ++-- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 ++-- arch/mips

let import_iovec deal with compat_iovecs as well v2

2020-09-21 Thread Christoph Hellwig
Hi Al, this series changes import_iovec to transparently deal with comat iovec structures, and then cleanups up a lot of code dupliation. Changes since v1: - improve a commit message - drop a pointless unlikely - drop the PF_FORCE_COMPAT flag - add a few more cleanups (including two from

[PATCH 05/11] iov_iter: merge the compat case into rw_copy_check_uvector

2020-09-21 Thread Christoph Hellwig
Stop duplicating the iovec verify code, and instead add add a __import_iovec helper that does the whole verify and import, but takes a bool compat to decided on the native or compat layout. This also ends up massively simplifying the calling conventions. Signed-off-by: Christoph Hellwig

[PATCH 01/11] compat.h: fix a spelling error in

2020-09-21 Thread Christoph Hellwig
There is no compat_sys_readv64v2 syscall, only a compat_sys_preadv64v2 one. Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index b354ce58966e2d..654c1ec36671a4 100644

[PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Christoph Hellwig
in a super hot path. Signed-off-by: David Laight [hch: expanded the commit log, pass CHECK_IOVEC_ONLY instead of 0 for the compat case, handle CHECK_IOVEC_ONLY in iov_iter_init] Signed-off-by: Christoph Hellwig --- lib/iov_iter.c | 2 +- mm/process_vm_access.c | 33

[PATCH 04/11] iov_iter: explicitly check for CHECK_IOVEC_ONLY in rw_copy_check_uvector

2020-09-21 Thread Christoph Hellwig
Explicitly check for the magic value insted of implicitly relying on its numeric representation. Also drop the rather pointless unlikely annotation. Signed-off-by: Christoph Hellwig --- lib/iov_iter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/iov_iter.c b

[PATCH 06/11] iov_iter: handle the compat case in import_iovec

2020-09-21 Thread Christoph Hellwig
of native or compat syscalls. Expose the low-level __import_iovec helper and use it in io_uring to explicitly pick a iovec layout. Signed-off-by: Christoph Hellwig --- block/scsi_ioctl.c | 12 ++-- drivers/scsi/sg.c | 9 + fs/aio.c | 38

[PATCH 03/11] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c and mark it static

2020-09-21 Thread Christoph Hellwig
From: David Laight This lets the compiler inline it into import_iovec() generating much better code. Signed-off-by: David Laight [hch: drop the now pointless kerneldoc for a static function, and update a few other comments] Signed-off-by: Christoph Hellwig --- fs/read_write.c

Re: [patch RFC 02/15] highmem: Provide generic variant of kmap_atomic*

2020-09-21 Thread Christoph Hellwig
> +# ifndef ARCH_NEEDS_KMAP_HIGH_GET > +static inline void *arch_kmap_temporary_high_get(struct page *page) > +{ > + return NULL; > +} > +# endif Turn this into a macro and use #ifndef on the symbol name? > +static inline void __kunmap_atomic(void *addr) > +{ > +

Re: [patch RFC 01/15] mm/highmem: Un-EXPORT __kmap_atomic_idx()

2020-09-21 Thread Christoph Hellwig
On Sat, Sep 19, 2020 at 11:17:52AM +0200, Thomas Gleixner wrote: > Nothing in modules can use that. > > Signed-off-by: Thomas Gleixner Looks good, Reviewed-by: Christoph Hellwig

Re: let import_iovec deal with compat_iovecs as well

2020-09-20 Thread 'Christoph Hellwig'
On Sat, Sep 19, 2020 at 02:24:10PM +, David Laight wrote: > I thought about that change while writing my import_iovec() => iovec_import() > patch - and thought that the io_uring code would (as usual) cause grief. > > Christoph - did you see those patches? No.

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Christoph Hellwig
On Sun, Sep 20, 2020 at 12:14:49PM -0700, Andy Lutomirski wrote: > I wonder if this is really quite cast in stone. We could also have > FMODE_SHITTY_COMPAT and set that when a file like this is *opened* in > compat mode. Then that particular struct file would be read and > written using the

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-18 Thread Christoph Hellwig
On Fri, Sep 18, 2020 at 02:58:22PM +0100, Al Viro wrote: > Said that, why not provide a variant that would take an explicit > "is it compat" argument and use it there? And have the normal > one pass in_compat_syscall() to that... That would help to not introduce a regression with this series

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-18 Thread Christoph Hellwig
On Fri, Sep 18, 2020 at 02:40:12PM +0100, Al Viro wrote: > > /* Vector 0x110 is LINUX_32BIT_SYSCALL_TRAP */ > > - return pt_regs_trap_type(current_pt_regs()) == 0x110; > > + return pt_regs_trap_type(current_pt_regs()) == 0x110 || > > + (current->flags & PF_FORCE_COMPAT); > >

[PATCH 8/9] mm: remove compat_process_vm_{readv,writev}

2020-09-18 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 +- arch/mips/kernel/syscalls/syscall_o32.tbl

[PATCH 2/9] compat.h: fix a spelling error in

2020-09-18 Thread Christoph Hellwig
We only have not compat_sys_readv64v2 syscall, only a compat_sys_preadv64v2 syscall one. This probably worked given that the syscall was not referenced from anywhere but the x86 syscall table. Signed-off-by: Christoph Hellwig --- include/linux/compat.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 9/9] security/keys: remove compat_keyctl_instantiate_key_iov

2020-09-18 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native version of keyctl_instantiate_key_iov can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- security/keys/compat.c | 36 ++-- security/keys/internal.h | 5 - security/keys

[PATCH 3/9] fs: explicitly check for CHECK_IOVEC_ONLY in rw_copy_check_uvector

2020-09-18 Thread Christoph Hellwig
Explicitly check for the magic value insted of implicitly relying on its number representation. Signed-off-by: Christoph Hellwig --- fs/read_write.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/read_write.c b/fs/read_write.c index 5db58b8c78d0dd..f153116bc5399b

let import_iovec deal with compat_iovecs as well

2020-09-18 Thread Christoph Hellwig
Hi Al, this series changes import_iovec to transparently deal with comat iovec structures, and then cleanups up a lot of code dupliation. But to get there it first has to fix the pre-existing bug that io_uring compat contexts don't trigger the in_compat_syscall() check. This has so far been

[PATCH 7/9] fs: remove compat_sys_vmsplice

2020-09-18 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native vmsplice syscall can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 2 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls

[PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-18 Thread Christoph Hellwig
Add a flag to force processing a syscall as a compat syscall. This is required so that in_compat_syscall() works for I/O submitted by io_uring helper threads on behalf of compat syscalls. Signed-off-by: Christoph Hellwig --- arch/sparc/include/asm/compat.h | 3 ++- arch/x86/include/asm

[PATCH 5/9] fs: remove various compat readv/writev helpers

2020-09-18 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs as well, all the duplicated code in the compat readv/writev helpers is not needed. Remove them and switch the compat syscall handlers to use the native helpers. Signed-off-by: Christoph Hellwig --- fs/read_write.c | 179

[PATCH 6/9] fs: remove the compat readv/writev syscalls

2020-09-18 Thread Christoph Hellwig
Now that import_iovec handles compat iovecs, the native readv and writev syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/unistd32.h | 4 ++-- arch/mips/kernel/syscalls/syscall_n32.tbl | 4 ++-- arch/mips

[PATCH 4/9] fs: handle the compat case in import_iovec

2020-09-18 Thread Christoph Hellwig
Use in compat_syscall to import either native or the compat iovecs, and remove the now superflous compat_import_iovec. Signed-off-by: Christoph Hellwig --- block/scsi_ioctl.c | 12 +--- drivers/scsi/sg.c | 9 +-- fs/aio.c | 38 +--- fs/io_uring.c

Re: [PATCH kernel] powerpc/dma: Fix dma_map_ops::get_required_mask

2020-09-15 Thread Christoph Hellwig
On Wed, Sep 09, 2020 at 07:36:04PM +1000, Alexey Kardashevskiy wrote: > I want dma_get_required_mask() to return the bigger mask always. > > Now it depends on (in dma_alloc_direct()): > 1. dev->dma_ops_bypass: set via pci_set_(coherent_)dma_mask(); > 2. dev->coherent_dma_mask - the same; > 3.

Re: [PATCH kernel] powerpc/dma: Fix dma_map_ops::get_required_mask

2020-09-08 Thread Christoph Hellwig
On Tue, Sep 08, 2020 at 10:06:56PM +1000, Alexey Kardashevskiy wrote: > On 08/09/2020 15:44, Christoph Hellwig wrote: >> On Tue, Sep 08, 2020 at 11:51:06AM +1000, Alexey Kardashevskiy wrote: >>> What is dma_get_required_mask() for anyway? What "requires" what here? &

Re: [PATCH kernel] powerpc/dma: Fix dma_map_ops::get_required_mask

2020-09-07 Thread Christoph Hellwig
On Tue, Sep 08, 2020 at 11:51:06AM +1000, Alexey Kardashevskiy wrote: > What is dma_get_required_mask() for anyway? What "requires" what here? Yes, it is a really odd API. It comes from classic old PCI where 64-bit addressing required an additional bus cycle, and various devices had different

Re: [PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-04 Thread Christoph Hellwig
On Fri, Sep 04, 2020 at 08:38:13AM +0200, Christoph Hellwig wrote: > > Wait a sec... how is that supposed to build with X86_5LEVEL? Do you mean > > > > #define LOAD_TASK_SIZE_MINUS_N(n) \ > > ALTERNATIVE __stringify(mov $((1 << 47) - 4096 - (n)),%rdx), \ >

Re: [PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-04 Thread Christoph Hellwig
On Fri, Sep 04, 2020 at 03:55:10AM +0100, Al Viro wrote: > On Thu, Sep 03, 2020 at 04:22:40PM +0200, Christoph Hellwig wrote: > > > diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S > > index c8a85b512796e1..94f7be4971ed04 100644 > > --- a/arch/x86/lib/getuser.

Re: [PATCH 0/2] dma-mapping: update default segment_boundary_mask

2020-09-03 Thread Christoph Hellwig
Applied with the recommendation from Michael folded in.

Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ?

Re: [PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 05:49:09PM +0200, Christoph Hellwig wrote: > On Thu, Sep 03, 2020 at 05:43:25PM +0200, Christophe Leroy wrote: > > > > > > Le 03/09/2020 à 16:22, Christoph Hellwig a écrit : > >> Stop providing the possibility to override the address

Re: [PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 05:43:25PM +0200, Christophe Leroy wrote: > > > Le 03/09/2020 à 16:22, Christoph Hellwig a écrit : >> Stop providing the possibility to override the address space using >> set_fs() now that there is no need for that any more. >> >>

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 03:36:29PM +0100, Al Viro wrote: > FWIW, vfs.git#for-next is always a merge of independent branches; I don't > put stuff directly into #for-next - too easy to lose that way. > > IOW, that would be something like #base.set_fs, included into #for-next > merge set. And I've

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 03:28:03PM +0100, Al Viro wrote: > On Thu, Sep 03, 2020 at 04:22:28PM +0200, Christoph Hellwig wrote: > > > Besides x86 and powerpc I plan to eventually convert all other > > architectures, although this will be a slow process, starting with the &g

[PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/processor.h | 7 arch/powerpc/include/asm/thread_info.h

[PATCH 13/14] powerpc: use non-set_fs based maccess routines

2020-09-03 Thread Christoph Hellwig
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 16 insertions

[PATCH 07/14] uaccess: add infrastructure for kernel builds with set_fs()

2020-09-03 Thread Christoph Hellwig
-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/Kconfig| 3 +++ arch/alpha/Kconfig | 1 + arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm64/Kconfig | 1 + arch/c6x/Kconfig| 1 + arch/csky/Kconfig | 1 + arch/h8300/Kconfig | 1

[PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
the hardcoded virtual address bits to escape the fact that TASK_SIZE_MAX isn't actually a constant when 5-level page tables are enabled. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/Kconfig | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm

[PATCH 11/14] x86: make TASK_SIZE_MAX usable from assembly code

2020-09-03 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h

[PATCH 10/14] x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32, 64}_types.h

2020-09-03 Thread Christoph Hellwig
At least for 64-bit this moves them closer to some of the defines they are based on, and it prepares for using the TASK_SIZE_MAX definition from assembly. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 11 +++ arch/x86/include/asm

[PATCH 09/14] lkdtm: remove set_fs-based tests

2020-09-03 Thread Christoph Hellwig
Once we can't manipulate the address limit, we also can't test what happens when the manipulation is abused. Signed-off-by: Christoph Hellwig --- drivers/misc/lkdtm/bugs.c | 10 -- drivers/misc/lkdtm/core.c | 2 -- drivers/misc/lkdtm/lkdtm.h

[PATCH 08/14] test_bitmap: remove user bitmap tests

2020-09-03 Thread Christoph Hellwig
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist, and it is about to go away for x86, powerpc with other major architectures to follow. Signed-off-by: Christoph Hellwig --- lib/test_bitmap.c | 91 +++ 1 file changed, 21

[PATCH 06/14] fs: don't allow splice read/write without explicit ops

2020-09-03 Thread Christoph Hellwig
bandwidth instances all provide a ->splice_read, so this just removes support for various device drivers and procfs/debugfs files. If splice support for any of those turns out to be important it can be added back by switching them to the iter ops and using generic_file_splice_read. Signed-off-

[PATCH 05/14] fs: don't allow kernel reads and writes without iter ops

2020-09-03 Thread Christoph Hellwig
nt semantics for messed up enough drivers. Also fails the kernel access to them in that case. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- fs/read_write.c | 67 +++-- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/fs/read_

[PATCH 03/14] proc: add a read_iter method to proc proc_ops

2020-09-03 Thread Christoph Hellwig
This will allow proc files to implement iter read semantics. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 53 ++--- include/linux/proc_fs.h | 1 + 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc

remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
Hi all, this series removes the last set_fs() used to force a kernel address space for the uaccess code in the kernel read/write/splice code, and then stops implementing the address space overrides entirely for x86 and powerpc. [Note to Linus: I'd like to get this into linux-next rather earlier

[PATCH 04/14] sysctl: Convert to iter interfaces

2020-09-03 Thread Christoph Hellwig
From: "Matthew Wilcox (Oracle)" Using the read_iter/write_iter interfaces allows for in-kernel users to set sysctls without using set_fs(). Also, the buffer is a string, so give it the real type of 'char *', not void *. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Christo

[PATCH 01/14] proc: remove a level of indentation in proc_get_inode

2020-09-03 Thread Christoph Hellwig
Just return early on inode allocation failure. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 72 + 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 28d6105e908e4c..016b1302cbabc0

[PATCH 02/14] proc: cleanup the compat vs no compat file ops

2020-09-03 Thread Christoph Hellwig
Instead of providing a special no-compat version provide a special compat version for operations with ->compat_ioctl. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c in

Re: [PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 11:02:22AM -0700, Linus Torvalds wrote: > I don't see why this change would make any difference. Me neither, but while looking at a different project I did spot places that actually do an access_ok with len 0, that's why I wanted him to try. That being said: Christophe

Re: [PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-09-02 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 08:15:12AM +0200, Christophe Leroy wrote: >> -return 0; >> -return (size == 0 || size - 1 <= seg.seg - addr); >> +if (addr >= TASK_SIZE_MAX) >> +return false; >> +if (size == 0) >> +return false; > > __access_ok() was

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v2

2020-09-02 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 06:25:12PM +0100, Al Viro wrote: > On Tue, Sep 01, 2020 at 07:13:00PM +0200, Christophe Leroy wrote: > > > 10.92% dd [kernel.kallsyms] [k] iov_iter_zero > > Interesting... Could you get an instruction-level profile inside > iov_iter_zero(), > along with the

Re: [PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-09-02 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 11:57:37AM -0700, Kees Cook wrote: > On Sat, Aug 29, 2020 at 11:24:06AM +0200, Christoph Hellwig wrote: > > On Thu, Aug 27, 2020 at 11:06:28AM -0700, Linus Torvalds wrote: > > > On Thu, Aug 27, 2020 at 8:00 AM Christoph Hellwig wrote: > > &

Re: [RESEND][PATCH 0/7] Avoid overflow at boundary_size

2020-09-01 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 12:54:01AM -0700, Nicolin Chen wrote: > Hi Christoph, > > On Tue, Sep 01, 2020 at 09:36:23AM +0200, Christoph Hellwig wrote: > > I really don't like all the open coded smarts in the various drivers. > > What do you think about a helper like the one

Re: [RESEND][PATCH 0/7] Avoid overflow at boundary_size

2020-09-01 Thread Christoph Hellwig
I really don't like all the open coded smarts in the various drivers. What do you think about a helper like the one in the untested patch below (on top of your series). Also please include the original segment boundary patch with the next resend so that the series has the full context. diff

Re: [fs] ef30fb3c60: kernel write not supported for file /sys/kernel/softlockup_panic

2020-09-01 Thread Christoph Hellwig
Looks like since the start of this series we've grown new code to use kernel_write on sysctl files based on boot parameters. The good news is that this just means I need to resurrect the sysctl series as all that work was done already.

Re: [PATCH 5/5] powerpc: use the generic dma_ops_bypass mode

2020-08-31 Thread Christoph Hellwig
On Sun, Aug 30, 2020 at 11:04:21AM +0200, Cédric Le Goater wrote: > Hello, > > On 7/8/20 5:24 PM, Christoph Hellwig wrote: > > Use the DMA API bypass mechanism for direct window mappings. This uses > > common code and speed up the direct mapping case by avoiding indirec

Re: [PATCH 08/10] x86: remove address space overrides using set_fs()

2020-08-29 Thread Christoph Hellwig
On Thu, Aug 27, 2020 at 11:15:12AM -0700, Linus Torvalds wrote: > > SYM_FUNC_START(__put_user_2) > > - ENTER > > - mov TASK_addr_limit(%_ASM_BX),%_ASM_BX > > + LOAD_TASK_SIZE_MAX > > sub $1,%_ASM_BX > > It's even more obvious here. We load a constant and then

Re: [PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-08-29 Thread Christoph Hellwig
On Thu, Aug 27, 2020 at 11:06:28AM -0700, Linus Torvalds wrote: > On Thu, Aug 27, 2020 at 8:00 AM Christoph Hellwig wrote: > > > > Once we can't manipulate the address limit, we also can't test what > > happens when the manipulation is abused. > > Just remove thes

Re: [PATCH 01/10] fs: don't allow kernel reads and writes without iter ops

2020-08-29 Thread 'Christoph Hellwig'
On Thu, Aug 27, 2020 at 03:58:02PM +, David Laight wrote: > Is there a real justification for that? > For system calls supplying both methods makes sense to avoid > the extra code paths for a simple read/write. Al asked for it as two of our four in-tree instances do have weird semantics, and

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v2

2020-08-27 Thread Christoph Hellwig
> Diffstat: Actually no diffstat here as David Howells pointed out. Here we go: arch/Kconfig |3 arch/alpha/Kconfig |1 arch/arc/Kconfig |1 arch/arm/Kconfig |1 arch/arm64/Kconfig

[PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-08-27 Thread Christoph Hellwig
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/processor.h | 7 --- arch/powerpc/include/asm/thread_info.h

[PATCH 08/10] x86: remove address space overrides using set_fs()

2020-08-27 Thread Christoph Hellwig
the hardcoded virtual address bits to escape the fact that TASK_SIZE_MAX isn't actually a constant when 5-level page tables are enabled. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/Kconfig | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm

[PATCH 09/10] powerpc: use non-set_fs based maccess routines

2020-08-27 Thread Christoph Hellwig
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 16 insertions

[PATCH 07/10] x86: make TASK_SIZE_MAX usable from assembly code

2020-08-27 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h

[PATCH 06/10] x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32, 64}_types.h

2020-08-27 Thread Christoph Hellwig
At least for 64-bit this moves them closer to some of the defines they are based on, and it prepares for using the TASK_SIZE_MAX definition from assembly. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 11 +++ arch/x86/include/asm

[PATCH 04/10] test_bitmap: skip user bitmap tests for !CONFIG_SET_FS

2020-08-27 Thread Christoph Hellwig
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- lib/test_bitmap.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index df903c53952bb9

[PATCH 02/10] fs: don't allow splice read/write without explicit ops

2020-08-27 Thread Christoph Hellwig
h bandwith instances all provide a ->splice_read, so this just removes support for various device drivers and procfs/debugfs files. If splice support for any of those turns out to be important it can be added back by switching them to the iter ops and using generic_file_splice_read. Signed-off-

[PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-08-27 Thread Christoph Hellwig
Once we can't manipulate the address limit, we also can't test what happens when the manipulation is abused. Signed-off-by: Christoph Hellwig --- drivers/misc/lkdtm/bugs.c | 4 drivers/misc/lkdtm/usercopy.c | 4 2 files changed, 8 insertions(+) diff --git a/drivers/misc/lkdtm

  1   2   3   4   5   6   7   8   9   10   >