Re: [PATCH] powerpc/mm: Fix KUAP warning by providing copy_from_kernel_nofault_allowed()

2020-12-05 Thread Christoph Hellwig
Yes, I think at this point in the release cycle the specific powerpc fix is safer anyway. But this screams for an eventual general solution.

Re: [PATCH] powerpc/mm: Fix KUAP warning by providing copy_from_kernel_nofault_allowed()

2020-12-05 Thread Christoph Hellwig
that copy_from_kernel_nofault() will return -ERANGE. Looks good. I wonder if we should just default to the TASK_SIZE_MAX check in copy_from_kernel_nofault_allowed for architectures that select CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE? > > Reported-by: Qian Cai > Fixes: c33165253492 (&q

Re: [PATCH V2 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Christoph Hellwig
You probably want to add Jason for an audit of new notifier uses. On Fri, Nov 20, 2020 at 06:32:40PM +0100, Christophe Lombard wrote: > Add invalidate_range mmu notifier, when required (ATSD access of MMIO > registers is available), to initiate TLB invalidation commands. > For the time being, the

Re: [PATCH kernel v4 2/2] powerpc/dma: Fallback to dma_ops when persistent memory present

2020-11-14 Thread Christoph Hellwig
On Thu, Oct 29, 2020 at 12:52:41PM +1100, Alexey Kardashevskiy wrote: > +EXPORT_SYMBOL_GPL(arch_dma_map_page_direct); I've dropped the unused exports and applied the series to dma-mapping-for-next.

Re: [PATCH 1/6] ibmvfc: byte swap login_buf.resp values in attribute show functions

2020-11-12 Thread Christoph Hellwig
On Wed, Nov 11, 2020 at 07:04:37PM -0600, Tyrel Datwyler wrote: > Both ibmvfc_show_host_(capabilities|npiv_version) functions retrieve > values from vhost->login_buf.resp buffer. This is the MAD response > buffer from the VIOS and as such any multi-byte non-string values are in > big endian format.

Re: [patch V2 00/18] mm/highmem: Preemptible variant of kmap_atomic & friends

2020-10-30 Thread Christoph Hellwig
On Thu, Oct 29, 2020 at 11:18:06PM +0100, Thomas Gleixner wrote: > This is achieved by: ... > > - Consolidating all kmap atomic implementations in generic code ... > Though I wanted to share the current state of affairs before investigating > that further. If there is consensus in going forwa

Re: [PATCH kernel v3 1/2] dma: Allow mixing bypass and mapped DMA operation

2020-10-28 Thread Christoph Hellwig
On Wed, Oct 28, 2020 at 06:00:29PM +1100, Alexey Kardashevskiy wrote: > At the moment we allow bypassing DMA ops only when we can do this for > the entire RAM. However there are configs with mixed type memory > where we could still allow bypassing IOMMU in most cases; > POWERPC with persistent memo

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-28 Thread Christoph Hellwig
On Wed, Oct 28, 2020 at 05:55:23PM +1100, Alexey Kardashevskiy wrote: > > It is passing an address of the end of the mapped area so passing a page > struct means passing page and offset which is an extra parameter and we do > not want to do anything with the page in those hooks anyway so I'd keep

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-27 Thread Christoph Hellwig
> +static inline bool dma_handle_direct(struct device *dev, dma_addr_t > dma_handle) > +{ > + return dma_handle >= dev->archdata.dma_offset; > +} This won't compile except for powerpc, and directly accesing arch members in common code is a bad idea. Maybe both your helpers need to be suppl

Re: [PATCH kernel 0/2] powerpc/dma: Fallback to dma_ops when persistent memory present

2020-10-27 Thread Christoph Hellwig
On Wed, Oct 21, 2020 at 02:20:24PM +1100, Alexey Kardashevskiy wrote: > This allows mixing direct DMA (to/from RAM) and > IOMMU (to/from apersistent memory) on the PPC64/pseries > platform. This was supposed to be a single patch but > unexpected move of direct DMA functions happened. > > This is b

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

2020-10-27 Thread Christoph Hellwig
On Tue, Oct 27, 2020 at 09:51:34AM +, David Howells wrote: > David Howells wrote: > > > > default_file_splice_write is the last piece of generic code that uses > > > set_fs to make the uaccess routines operate on kernel pointers. It > > > implements a "fallback loop" for splicing from files

Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c"

2020-10-22 Thread Christoph Hellwig
On Thu, Oct 22, 2020 at 11:36:40AM +0200, David Hildenbrand wrote: > My thinking: if the compiler that calls import_iovec() has garbage in > the upper 32 bit > > a) gcc will zero it out and not rely on it being zero. > b) clang will not zero it out, assuming it is zero. > > But > > a) will zero

Re: [PATCH 3/8] powerpc: Mark functions called inside uaccess blocks w/ 'notrace'

2020-10-15 Thread Christoph Hellwig
On Thu, Oct 15, 2020 at 10:01:54AM -0500, Christopher M. Riedl wrote: > Functions called between user_*_access_begin() and user_*_access_end() > should be either inlined or marked 'notrace' to prevent leaving > userspace access exposed. Mark any such functions relevant to signal > handling so that

Re: [PATCH 1/8] powerpc/uaccess: Add unsafe_copy_from_user

2020-10-15 Thread Christoph Hellwig
On Thu, Oct 15, 2020 at 10:01:52AM -0500, Christopher M. Riedl wrote: > Implement raw_copy_from_user_allowed() which assumes that userspace read > access is open. Use this new function to implement raw_copy_from_user(). > Finally, wrap the new function to follow the usual "unsafe_" convention > of

Re: [RFC v1 0/2] Plumbing to support multiple secure memory backends.

2020-10-13 Thread Christoph Hellwig
Please don't add an abstraction without a second implementation. Once we have the implementation we can consider the tradeoffs. E.g. if expensive indirect function calls are really needed vs simple branches.

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

2020-10-13 Thread Christoph Hellwig
On Sat, Oct 10, 2020 at 01:55:24AM +, Alexander Viro wrote: > FWIW, I hadn't pushed that branch out (or merged it into #for-next yet); > for one thing, uml part (mconsole) is simply broken, for another... > IMO ##5--8 are asking for kernel_pread() and if you look at binfmt_elf.c, > you'll see e

Re: [PATCH RFC PKS/PMEM 24/58] fs/freevxfs: Utilize new kmap_thread()

2020-10-13 Thread Christoph Hellwig
> - kaddr = kmap(pp); > + kaddr = kmap_thread(pp); > memcpy(kaddr, vip->vii_immed.vi_immed + offset, PAGE_SIZE); > - kunmap(pp); > + kunmap_thread(pp); You only Cced me on this particular patch, which means I have absolutely no idea what kmap_thread and kunmap_thread actually

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-07 Thread Christoph Hellwig
On Wed, Oct 07, 2020 at 04:42:55PM +0200, Jann Horn wrote: > > > @@ -43,7 +43,7 @@ static inline long do_mmap2(unsigned long addr, size_t > > > len, > > > { > > > long ret = -EINVAL; > > > > > > - if (!arch_validate_prot(prot, addr)) > > > + if (!arch_validate_prot(prot, addr, len))

Re: [PATCH 2/2] sparc: Check VMA range in sparc_validate_prot()

2020-10-07 Thread Christoph Hellwig
> +++ b/arch/sparc/include/asm/mman.h > @@ -60,31 +60,41 @@ static inline int sparc_validate_prot(unsigned long prot, > unsigned long addr, > if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_ADI)) > return 0; > if (prot & PROT_ADI) { > + struc

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-07 Thread Christoph Hellwig
On Wed, Oct 07, 2020 at 09:39:31AM +0200, Jann Horn wrote: > diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c > index 078608ec2e92..b1fabb97d138 100644 > --- a/arch/powerpc/kernel/syscalls.c > +++ b/arch/powerpc/kernel/syscalls.c > @@ -43,7 +43,7 @@ static inline long do

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
stead 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.

[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 - ref

[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 dr

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

2020-09-22 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-22 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-22 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-22 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-22 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-22 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 __i

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

2020-09-22 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-22 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-22 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-22 Thread Christoph Hellwig
stead 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.

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 difference

[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 Davi

[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
x27;t 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

[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
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-20 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) > +{ > + kumap_atomic_indexed(addr

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

2020-09-20 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 compa

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 yes.

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); > > Can'

[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 rela

[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-14 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. dev-

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 add

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-03 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 ? dma_g

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 space usin

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 n

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 > &

[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
: 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
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/includ

[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/lkd

[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 c

[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
ent 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/

[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 t

[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-b

[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

<    4   5   6   7   8   9   10   11   12   13   >