Re: [PATCH 1/2] mm: add GFP mask param to strndup_user

2020-08-15 Thread Al Viro
On Sat, Aug 15, 2020 at 11:23:43AM -0700, Pascal Bouchareine wrote: > Let caller specify allocation. > Preserve existing calls with GFP_USER. Bloody bad idea, unless you slap a BUG_ON(flags & GFP_ATOMIC) on it, to make sure nobody tries _that_. Note that copying from userland is an inherently

Re: [PATCH][v2] proc: use vmalloc for our kernel buffer

2020-08-13 Thread Al Viro
On Thu, Aug 13, 2020 at 01:19:18PM -0400, Josef Bacik wrote: > > in sunrpc proc_dodebug() turns into > > left -= snprintf(buffer, left, "0x%04x\n", left + 1, that is. > >

Re: [PATCH] proc: use vmalloc for our kernel buffer

2020-08-13 Thread Al Viro
On Thu, Aug 13, 2020 at 04:19:27PM +, David Laight wrote: > From: Josef Bacik > > Sent: 13 August 2020 15:53 > > > > sysctl: pass kernel pointers to ->proc_handler > > > > we have been pre-allocating a buffer to copy the data from the proc > > handlers into, and then copying that to

Re: [PATCH][v2] proc: use vmalloc for our kernel buffer

2020-08-13 Thread Al Viro
On Thu, Aug 13, 2020 at 05:41:17PM +0200, Christoph Hellwig wrote: > On Thu, Aug 13, 2020 at 11:40:00AM -0400, Josef Bacik wrote: > > On 8/13/20 11:37 AM, Christoph Hellwig wrote: > >> On Thu, Aug 13, 2020 at 11:33:56AM -0400, Josef Bacik wrote: > >>> Since > >>> > >>>sysctl: pass kernel

Re: [PATCH] fs/select.c: batch user writes in do_sys_poll

2020-08-13 Thread Al Viro
On Thu, Aug 13, 2020 at 09:36:52PM +1000, Daniel Axtens wrote: > Hi, > > >> Seem like this could simply use a copy_to_user to further simplify > >> things? > > > > I'll benchmark it and find out. > > I tried this: > > for (walk = head; walk; walk = walk->next) { > - struct

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 07:33:26PM +0100, Al Viro wrote: > BTW, what would such opened files look like from /proc/*/fd/* POV? And > what would happen if you walk _through_ that symlink, with e.g. ".." > following it? Or with names of those attributes, for that matter... &g

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 06:39:11PM +0100, Al Viro wrote: > On Wed, Aug 12, 2020 at 07:16:37PM +0200, Miklos Szeredi wrote: > > On Wed, Aug 12, 2020 at 6:33 PM Al Viro wrote: > > > > > > On Wed, Aug 12, 2020 at 05:13:14PM +0200, Miklos Szeredi wrote: > > > >

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 07:16:37PM +0200, Miklos Szeredi wrote: > On Wed, Aug 12, 2020 at 6:33 PM Al Viro wrote: > > > > On Wed, Aug 12, 2020 at 05:13:14PM +0200, Miklos Szeredi wrote: > > > > Why does it have to have a struct mount? It does not have to use > >

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 05:13:14PM +0200, Miklos Szeredi wrote: > > Lovely. And what of fchdir() to those? > > Not allowed. Not allowed _how_? Existing check is "is it a directory"; what do you propose? IIRC, you've mentioned using readdir() in that context, so it's not that you only allow

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 04:46:20PM +0200, Miklos Szeredi wrote: > > "Can those suckers be passed to > > ...at() as starting points? > > No. Lovely. And what of fchdir() to those? Are they all non-directories? Because the starting point of ...at() can be simulated that way... > > Can they be

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-12 Thread Al Viro
On Wed, Aug 12, 2020 at 09:23:23AM +0200, Miklos Szeredi wrote: > Anyway, starting with just introducing the alt namespace without > unification seems to be a good first step. If that turns out to be > workable, we can revisit unification later. Start with coming up with answers to the questions

Re: [PATCH] Re: KASAN: use-after-free Read in path_init (2)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 09:29:47PM -0700, Linus Torvalds wrote: > On Tue, Aug 11, 2020 at 9:15 PM Al Viro wrote: > > > > fix breakage in do_rmdir() > > > > putname() should happen only after we'd *not* branched to > > retry, same as it's done in do_unlinka

[PATCH] Re: KASAN: use-after-free Read in path_init (2)

2020-08-11 Thread Al Viro
290 fix breakage in do_rmdir() putname() should happen only after we'd *not* branched to retry, same as it's done in do_unlinkat(). Fixes: e24ab0ef689d "fs: push the getname from do_rmdir into the callers" Signed-off-by: Al Viro --- diff --git a/fs/namei.c b/fs/namei.c index fde8fe0

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 10:28:31PM +0200, Miklos Szeredi wrote: > On Tue, Aug 11, 2020 at 6:17 PM Casey Schaufler > wrote: > > > Since ab has known meaning, and lots of applications > > play loose with '/', its really dangerous to treat the string as > > special. We only get away with

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 09:09:36AM -0700, Linus Torvalds wrote: > On Tue, Aug 11, 2020 at 9:05 AM Al Viro wrote: > > > > Except that you suddenly see non-directory dentries get children. > > And a lot of dcache-related logics needs to be changed if that > > becomes p

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 08:20:24AM -0700, Linus Torvalds wrote: > I don't think this works for the reasons Al says, but a slight > modification might. > > IOW, if you do something more along the lines of > >fd = open(""foo/bar", O_PATH); >metadatafd = openat(fd, "metadataname",

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 04:36:32PM +0200, Miklos Szeredi wrote: > > > - strip off trailing part after first instance of /// > > > - perform path lookup as normal > > > - resolve meta path after /// on result of normal lookup > > > > ... and interpolation of relative symlink body into the

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 10:33:59AM -0400, Tang Jiye wrote: > anyone knows how to post a question? Generally the way you just have, except that you generally put it *after* the relevant parts of the quoted text (and removes the irrelevant ones).

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 04:22:19PM +0200, Miklos Szeredi wrote: > On Tue, Aug 11, 2020 at 4:08 PM Al Viro wrote: > > > > On Tue, Aug 11, 2020 at 03:54:19PM +0200, Miklos Szeredi wrote: > > > On Wed, Aug 05, 2020 at 10:24:23AM +0200, Miklos Szeredi wrote: > > >

Re: file metadata via fs API (was: [GIT PULL] Filesystem Information)

2020-08-11 Thread Al Viro
On Tue, Aug 11, 2020 at 03:54:19PM +0200, Miklos Szeredi wrote: > On Wed, Aug 05, 2020 at 10:24:23AM +0200, Miklos Szeredi wrote: > > On Tue, Aug 4, 2020 at 4:36 PM Miklos Szeredi wrote: > > > > > I think we already lost that with the xattr API, that should have been > > > done in a way that

Re: [PATCH v7 0/7] Add support for O_MAYEXEC

2020-08-10 Thread Al Viro
On Tue, Aug 11, 2020 at 12:43:52AM +0200, Mickaël Salaün wrote: > Hooking on open is a simple design that enables processes to check files > they intend to open, before they open them. Which is a good thing, because...? > From an API point of view, > this series extends openat2(2) with one

Re: [PATCH v7 0/7] Add support for O_MAYEXEC

2020-08-10 Thread Al Viro
On Mon, Aug 10, 2020 at 10:09:09PM +, David Laight wrote: > > On Mon, Aug 10, 2020 at 10:11:53PM +0200, Mickaël Salaün wrote: > > > It seems that there is no more complains nor questions. Do you want me > > > to send another series to fix the order of the S-o-b in patch 7? > > > > There is a

Re: [PATCH v7 0/7] Add support for O_MAYEXEC

2020-08-10 Thread Al Viro
On Mon, Aug 10, 2020 at 10:11:53PM +0200, Mickaël Salaün wrote: > It seems that there is no more complains nor questions. Do you want me > to send another series to fix the order of the S-o-b in patch 7? There is a major question regarding the API design and the choice of hooking that stuff on

[git pull] assorted vfs patches

2020-08-07 Thread Al Viro
://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc for you to fetch changes up to 6414e9b09ffd197803f8e86ce2fafdaf1de4e8e4: fs: define inode flags using bit numbers (2020-07-27 14:39:53 -0400) Al Viro (1): dlmfs

[git pull] regression fix in syscalls-for-init series

2020-08-07 Thread Al Viro
The following changes since commit f073531070d24bbb82cb2658952d949f4851024b: init: add an init_dup helper (2020-08-04 21:02:38 -0400) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git fixes for you to fetch changes up to

Re: [PATCH v6 1/3] Add a new LSM-supporting anonymous inode interface

2020-08-07 Thread Al Viro
On Fri, Aug 07, 2020 at 03:49:39PM -0700, Lokesh Gidra wrote: > The new functions accept an optional context_inode parameter that > callers can use to provide additional contextual information to > security modules, e.g., indicating that one anonymous struct file is a > logical child of another,

[git pull] fdpic coredump stuff

2020-08-07 Thread Al Viro
400) ---- Al Viro (7): unexport linux/elfcore.h take fdpic-related parts of elf_prstatus out kill elf_fpxregs_t [elf-fdpic] coredump: don't bother with cyclic list for per-thread objects [elf-fdpic] move allocat

Re: srvfs: file system for posting open file descriptors into fs namespace

2020-08-07 Thread Al Viro
On Fri, Aug 07, 2020 at 01:09:30PM +0200, Enrico Weigelt, metux IT consult wrote: > Hello folks, > > > here's the first version of my "srvfs" implementation - a synthentic > filesystem which allows a process to "publish" an open file descriptor > into the file system, so other processes can

Re: splice: infinite busy loop lockup bug

2020-08-07 Thread Al Viro
On Fri, Aug 07, 2020 at 01:27:27PM +0100, Al Viro wrote: > On Fri, Aug 07, 2020 at 07:35:08PM +0900, Tetsuo Handa wrote: > > syzbot is reporting hung task at pipe_release() [1], for for_each_bvec() > > from > > iterate_bvec() from iterate_all_kinds() from iov_

Re: splice: infinite busy loop lockup bug

2020-08-07 Thread Al Viro
On Fri, Aug 07, 2020 at 07:35:08PM +0900, Tetsuo Handa wrote: > syzbot is reporting hung task at pipe_release() [1], for for_each_bvec() from > iterate_bvec() from iterate_all_kinds() from iov_iter_alignment() from > ext4_unaligned_io() from ext4_dio_write_iter() from ext4_file_write_iter() >

[git pull] regset work

2020-08-06 Thread Al Viro
set: kill user_regset_copyout{,_zero}() (2020-07-27 14:31:13 -0400) ---- Al Viro (42): x86: copy_fpstate_to_sigframe(): have fpregs_soft_get() use kernel buffer x86: kill dump_fpu() [ia64] sanitize elf_access_gpreg()

Re: [LTP-FAIL][02/21] fs: refactor ksys_umount

2020-08-06 Thread Al Viro
On Thu, Aug 06, 2020 at 04:17:32PM +0200, Christoph Hellwig wrote: > Fix for umount03 below. The other one works fine here, but from > your logs this might be a follow on if you run it after umount without > the fix. Ugh... How about static int may_umount(const struct path *path, int flags) {

Re: [PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-06 Thread Al Viro
On Thu, Aug 06, 2020 at 12:59:16PM +0100, Al Viro wrote: > On Thu, Aug 06, 2020 at 07:53:16PM +0800, linmiaohe wrote: > > From: Miaohe Lin > > > > We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed > > accordingly. > > > > Fi

Re: [PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-06 Thread Al Viro
On Thu, Aug 06, 2020 at 07:53:16PM +0800, linmiaohe wrote: > From: Miaohe Lin > > We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed > accordingly. > > Fixes: 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Waway from > fget_light") Explain, please. We are

[git pull] Christoph's init series

2020-08-04 Thread Al Viro
Christoph's "getting rid of ksys_...() uses under KERNEL_DS" stuff. One trivial conflict (drivers/md/md.c). The following changes since commit f8456690ba8eb18ea4714e68554e242a04f65cff: Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux into

Re: [PATCH 1/2] riscv: ptrace: Use the correct API for `fcsr' access

2020-08-04 Thread Al Viro
On Tue, Aug 04, 2020 at 07:20:05PM -0700, Palmer Dabbelt wrote: > On Tue, 04 Aug 2020 19:07:45 PDT (-0700), v...@zeniv.linux.org.uk wrote: > > On Tue, Aug 04, 2020 at 07:01:01PM -0700, Palmer Dabbelt wrote: > > > > > > We currently have @start_pos fixed at 0 across all calls, which works as > > >

Re: [PATCH 1/2] riscv: ptrace: Use the correct API for `fcsr' access

2020-08-04 Thread Al Viro
On Tue, Aug 04, 2020 at 07:01:01PM -0700, Palmer Dabbelt wrote: > > We currently have @start_pos fixed at 0 across all calls, which works as > > a result of the implementation, in particular because we have no padding > > between the FP general registers and the FP control and status register, >

Re: [PATCH 2/2] dmabuf/tracing: Add dma-buf trace events

2020-08-04 Thread Al Viro
On Tue, Aug 04, 2020 at 03:44:51PM +, Kalesh Singh wrote: > Hi Al. Thank you for the comments. Ultimately what we need is to identify > processes > that hold a file reference to the dma-buf. Unfortunately we can't use only > explicit dma_buf_get/dma_buf_put to track them because when an FD

Re: [PATCH 2/2] dmabuf/tracing: Add dma-buf trace events

2020-08-03 Thread Al Viro
On Mon, Aug 03, 2020 at 11:28:31PM +0100, Al Viro wrote: > IOW, what the hell is that horror for? You do realize, for example, that > there's > such thing as dup(), right? And dup2() as well. And while we are at it, how > do you keep track of removals, considering the fact that y

Re: [PATCH 2/2] dmabuf/tracing: Add dma-buf trace events

2020-08-03 Thread Al Viro
On Mon, Aug 03, 2020 at 09:22:53AM -0700, Suren Baghdasaryan wrote: > On Mon, Aug 3, 2020 at 9:12 AM Matthew Wilcox wrote: > > > > On Mon, Aug 03, 2020 at 09:00:00AM -0700, Suren Baghdasaryan wrote: > > > On Mon, Aug 3, 2020 at 8:41 AM Matthew Wilcox wrote: > > > > > > > > On Mon, Aug 03, 2020

Re: [PATCH 1/2] fs: Add fd_install file operation

2020-08-03 Thread Al Viro
On Mon, Aug 03, 2020 at 02:47:18PM +, Kalesh Singh wrote: > Provides a per process hook for the acquisition of file descriptors, > despite the method used to obtain the descriptor. No, with the side of Fuck, No. Driver has no possible reason to watch know the descriptors involved. Moreover,

Re: add file system helpers that take kernel pointers for the init code v4

2020-07-30 Thread Al Viro
On Thu, Jul 30, 2020 at 08:25:24AM +0200, Christoph Hellwig wrote: > On Wed, Jul 29, 2020 at 08:51:17PM +0100, Al Viro wrote: > > On Tue, Jul 28, 2020 at 06:33:53PM +0200, Christoph Hellwig wrote: > > > Hi Al and Linus, > > > > > > currently a lot of the fi

Re: [PATCH 22/23] fs: default to generic_file_splice_read for files having ->read_iter

2020-07-30 Thread Al Viro
On Thu, Jul 30, 2020 at 05:17:01PM +0100, Al Viro wrote: > On Thu, Jul 30, 2020 at 05:20:46PM +0200, Christoph Hellwig wrote: > > > Fortunately I think the fix is pretty easy - remove the special pipe > > zero copy optimization from copy_page_to_iter, and just have the > &g

Re: [PATCH 22/23] fs: default to generic_file_splice_read for files having ->read_iter

2020-07-30 Thread Al Viro
On Thu, Jul 30, 2020 at 05:20:46PM +0200, Christoph Hellwig wrote: > Fortunately I think the fix is pretty easy - remove the special pipe > zero copy optimization from copy_page_to_iter, and just have the > callers actually want it because they have pagecache or similar > refcountable pages use

Re: [PATCH 22/23] fs: default to generic_file_splice_read for files having ->read_iter

2020-07-30 Thread Al Viro
On Thu, Jul 30, 2020 at 09:03:29AM +0200, Christoph Hellwig wrote: > On Thu, Jul 30, 2020 at 01:05:44AM +0100, Al Viro wrote: > > On Tue, Jul 07, 2020 at 07:48:00PM +0200, Christoph Hellwig wrote: > > > If a file implements the ->read_iter method, the iter based sp

Re: [PATCH 22/23] fs: default to generic_file_splice_read for files having ->read_iter

2020-07-29 Thread Al Viro
On Tue, Jul 07, 2020 at 07:48:00PM +0200, Christoph Hellwig wrote: > If a file implements the ->read_iter method, the iter based splice read > works and is always preferred over the ->read based one. Use it by > default in do_splice_to and remove all the direct assignment of >

Re: [PATCH 15/23] seq_file: switch over direct seq_read method calls to seq_read_iter

2020-07-29 Thread Al Viro
On Fri, Jul 17, 2020 at 11:09:13PM +0200, Thomas Gleixner wrote: > > Needs some thought and maybe some cocci help from Julia, but that's way > better than this brute force sed thing which results in malformed crap > like this: > > static const struct file_operations debug_stats_fops = { >

Re: [PATCH 08/23] fs: don't change the address limit for ->write_iter in __kernel_write

2020-07-29 Thread Al Viro
On Tue, Jul 07, 2020 at 07:47:46PM +0200, Christoph Hellwig wrote: > If we write to a file that implements ->write_iter there is no need > to change the address limit if we send a kvec down. Implement that > case, and prefer it over using plain ->write with a changed address > limit if available.

Re: add file system helpers that take kernel pointers for the init code v4

2020-07-29 Thread Al Viro
On Tue, Jul 28, 2020 at 06:33:53PM +0200, Christoph Hellwig wrote: > Hi Al and Linus, > > currently a lot of the file system calls in the early in code (and the > devtmpfs kthread) rely on the implicit set_fs(KERNEL_DS) during boot. > This is one of the few last remaining places we need to deal

Re: linux-next: build failure after merge of the vfs tree

2020-07-29 Thread Al Viro
On Wed, Jul 29, 2020 at 08:33:05AM +0200, Christoph Hellwig wrote: > Thanks, > > I've sent out a fixed version. #work.quota-compat and #for-next rebuilt (and pushed) with it...

Re: [RFC PATCH v5 05/11] fs: add security blob and hooks for block_device

2020-07-28 Thread Al Viro
On Tue, Jul 28, 2020 at 03:22:59PM -0700, Casey Schaufler wrote: > > + hlist_for_each_entry(p, _hook_heads.bdev_setsecurity, list) { > > + rc = p->hook.bdev_setsecurity(bdev, name, value, size); > > + > > + if (rc == -ENOSYS) > > + rc = 0; > > + > > +

Re: [PATCH 4/4] quota: simplify the quotactl compat handling

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 11:31:58PM +0200, Jan Kara wrote: > On Mon 27-07-20 16:56:16, Al Viro wrote: > > On Mon, Jul 27, 2020 at 02:41:27PM +0200, Jan Kara wrote: > > > On Sun 26-07-20 18:04:01, Christoph Hellwig wrote: > > > > Fold the misaligned u64 workaroun

Re: [PATCH][next] binfmt_elf: fix unsigned regset0_size compared to less than zero

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 06:40:54PM +0100, Colin King wrote: > From: Colin Ian King > > Variable regset0_size is an unsigned int and it is being checked > for an error by checking if it is less than zero, and hence this > check is always going to be false. Fix this by making the variable >

[PATCH net] fix a braino in cmsghdr_from_user_compat_to_kern()

2020-07-27 Thread Al Viro
at sendmsg() with several different-sized cmsg attached started to fail with EINVAL. Trivial to fix, fortunately. Reported-by: Nick Bowler Tested-by: Nick Bowler Fixes: 547ce4cfb34c ("switch cmsghdr_from_user_compat_to_kern() to copy_from_user()") Signed-off-by: Al Viro --- diff --git

[PATCH] Re: PROBLEM: cryptsetup fails to unlock drive in 5.8-rc6 (regression)

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 05:05:54PM +0100, Al Viro wrote: > On Thu, Jul 23, 2020 at 11:51:01AM -0400, Nick Bowler wrote: > > Hi, > > > > After installing Linux 5.8-rc6, it seems cryptsetup can no longer > > open LUKS volumes. Regardless of the entered passphras

Re: PROBLEM: cryptsetup fails to unlock drive in 5.8-rc6 (regression)

2020-07-27 Thread Al Viro
On Thu, Jul 23, 2020 at 11:51:01AM -0400, Nick Bowler wrote: > Hi, > > After installing Linux 5.8-rc6, it seems cryptsetup can no longer > open LUKS volumes. Regardless of the entered passphrase (correct > or otherwise), the result is a very unhelpful "Keyslot open failed." > message. > > On

Re: [PATCH 4/4] quota: simplify the quotactl compat handling

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 02:41:27PM +0200, Jan Kara wrote: > On Sun 26-07-20 18:04:01, Christoph Hellwig wrote: > > Fold the misaligned u64 workarounds into the main quotactl flow instead > > of implementing a separate compat syscall handler. > > > > Signed-off-by: Christoph Hellwig > > The

Re: [PATCH 18/23] init: open code setting up stdin/stdout/stderr

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 08:48:28AM +0200, Christoph Hellwig wrote: > On Mon, Jul 27, 2020 at 07:03:22AM +0100, Al Viro wrote: > > On Mon, Jul 27, 2020 at 07:46:25AM +0200, Christoph Hellwig wrote: > > > On Mon, Jul 27, 2020 at 04:05:34AM +0100, Al Viro wrote: > > > >

Re: get rid of the address_space override in setsockopt v2

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 09:51:45AM +, David Laight wrote: > I'm sure there is code that processes options in chunks. > This probably means it is possible to put a chunk boundary > at the end of userspace and continue processing the very start > of kernel memory. > > At best this faults on

Re: [PATCH 18/23] init: open code setting up stdin/stdout/stderr

2020-07-27 Thread Al Viro
On Mon, Jul 27, 2020 at 07:46:25AM +0200, Christoph Hellwig wrote: > On Mon, Jul 27, 2020 at 04:05:34AM +0100, Al Viro wrote: > > On Tue, Jul 14, 2020 at 09:04:22PM +0200, Christoph Hellwig wrote: > > > Don't rely on the implicit set_fs(KERNEL_DS) for ksys_open to work, but

Re: [PATCH v7 4/7] fs: Introduce O_MAYEXEC flag for openat2(2)

2020-07-26 Thread Al Viro
On Thu, Jul 23, 2020 at 07:12:24PM +0200, Mickaël Salaün wrote: > When the O_MAYEXEC flag is passed, openat2(2) may be subject to > additional restrictions depending on a security policy managed by the > kernel through a sysctl or implemented by an LSM thanks to the > inode_permission hook. This

Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 08:11:32AM +0100, Christoph Hellwig wrote: > On Fri, Jul 24, 2020 at 01:30:40PM +0100, Al Viro wrote: > > > Sorry, I meant csum_and_copy_from_nocheck, just as in this patch. > > > > > > Merging your branch into the net-next tree thus wi

Re: [PATCH 18/23] init: open code setting up stdin/stdout/stderr

2020-07-26 Thread Al Viro
On Tue, Jul 14, 2020 at 09:04:22PM +0200, Christoph Hellwig wrote: > Don't rely on the implicit set_fs(KERNEL_DS) for ksys_open to work, but > instead open a struct file for /dev/console and then install it as FD > 0/1/2 manually. I really hate that one. Every time we exposed the internal

Re: [PATCH 17/23] initramfs: switch initramfs unpacking to struct file based APIs

2020-07-26 Thread Al Viro
On Tue, Jul 14, 2020 at 09:04:21PM +0200, Christoph Hellwig wrote: > - ssize_t rv = ksys_write(fd, p, count); > + ssize_t rv = kernel_write(file, p, count, >f_pos); No. Sure, that'll work for ramfs with nobody else playing with those. However, this is the wrong way to do

Re: [PATCH 16/23] initramfs: simplify clean_rootfs

2020-07-26 Thread Al Viro
On Thu, Jul 23, 2020 at 04:27:34PM +0200, Christoph Hellwig wrote: > On Thu, Jul 23, 2020 at 04:25:34PM +0200, Lukasz Stelmach wrote: > > >> Can you comment out the call to d_genocide? It seems like for your > > >> the fact that clean_rootfs didn't actually clean up was a feature and > > >> not a

Re: [PATCH 12/23] initrd: switch initrd loading to struct file based APIs

2020-07-26 Thread Al Viro
On Tue, Jul 14, 2020 at 09:04:16PM +0200, Christoph Hellwig wrote: > static int __init > -identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) > +identify_ramdisk_image(struct file *file, int start_block, > + decompress_fn *decompressor) > { > -

Re: [PATCH] init/do_mounts: fix a coding style error

2020-07-26 Thread Al Viro
On Tue, Jul 14, 2020 at 03:02:58PM +0800, zhouchuangao wrote: > Fix code style errors reported by scripts/checkpatch.pl. NAKed-because: excessive deference to checkpatch.pl It's not a holy oracle than needs to be appeased, no questions asked. Reference to it is absolutely insufficient reason

Re: [PATCH 4/4] quota: simplify the quotactl compat handling

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 06:34:22PM +0200, Christoph Hellwig wrote: > On Sun, Jul 26, 2020 at 05:32:14PM +0100, Al Viro wrote: > > > +static int compat_copy_fs_qfilestat(struct compat_fs_qfilestat __user > > > *to, > > > + struct fs_qfilestat *from) >

Re: add file system helpers that take kernel pointers for the init code v3

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 06:26:27PM +0200, Christoph Hellwig wrote: > On Sun, Jul 26, 2020 at 06:24:26PM +0200, Christoph Hellwig wrote: > > Btw, care to take a look at > > > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/kernel_readwrite > > > > it has been in linux-next for

Re: [PATCH 4/4] quota: simplify the quotactl compat handling

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 06:04:01PM +0200, Christoph Hellwig wrote: > Fold the misaligned u64 workarounds into the main quotactl flow instead > of implementing a separate compat syscall handler. I can live with that (and drop the local quota-related stuff from copy_in_user/compat_alloc_user_space

Re: add file system helpers that take kernel pointers for the init code v3

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 05:52:04PM +0200, Christoph Hellwig wrote: > On Sun, Jul 26, 2020 at 08:49:28AM -0700, Linus Torvalds wrote: > > On Sun, Jul 26, 2020 at 12:14 AM Christoph Hellwig wrote: > > > > > > Hi Al and Linus, > > > > > > currently a lot of the file system calls in the early in code

Re: [PATCH] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Al Viro
On Fri, Jul 24, 2020 at 05:40:43PM -0700, Pascal Bouchareine wrote: > This command attaches a description to a file descriptor for > troubleshooting purposes. The free string is displayed in the > process fdinfo file for that fd /proc/pid/fdinfo/fd. > > One intended usage is to allow processes to

Re: [PATCH 04/18] csum_and_copy_..._user(): pass 0xffffffff instead of 0 as initial sum

2020-07-25 Thread Al Viro
On Tue, Jul 21, 2020 at 10:11:18PM +0100, Al Viro wrote: > Theoretically - sure. I can post the full analysis of that stuff (starting > with the proof that all instances of csum_partial() are OK in that respect, > which takes care of the default instances, then instance-by-instance &

Re: [git pull] xtensa csum regression fix

2020-07-24 Thread Al Viro
On Fri, Jul 24, 2020 at 07:16:44PM +0100, Al Viro wrote: Argh... Sorry, hit send too early; the missing summary would be Max Filippov has caught a breakage introduced in xtensa this cycle by the csum_and_copy_..._user() series. Cut'n'paste from the wrong source - the check that belongs

[git pull] xtensa csum regression fix

2020-07-24 Thread Al Viro
The following changes since commit b3a9e3b9622ae10064826dccb4f7a52bd88c7407: Linux 5.8-rc1 (2020-06-14 12:45:04 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git fixes for you to fetch changes up to

Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Al Viro
On Fri, Jul 24, 2020 at 01:23:37PM +0100, Christoph Hellwig wrote: > On Fri, Jul 24, 2020 at 01:19:18PM +0100, Al Viro wrote: > > > net-next has a patch from me killing off csum_and_copy_from_user > > > already: > > > > > > https://git.kernel.org/pub/s

Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Al Viro
On Fri, Jul 24, 2020 at 07:41:17AM +0100, Christoph Hellwig wrote: > On Fri, Jul 24, 2020 at 02:25:30AM +0100, Al Viro wrote: > > From: Al Viro > > > > quite a few architectures have the same csum_partial_copy_nocheck() - > > simply memcpy() the data and then

[PATCH v2 02/20] skb_copy_and_csum_bits(): don't bother with the last argument

2020-07-23 Thread Al Viro
From: Al Viro it's always 0 Signed-off-by: Al Viro --- drivers/net/ethernet/sun/sunvnet_common.c | 2 +- include/linux/skbuff.h| 2 +- net/core/skbuff.c | 11 ++- net/ipv4/icmp.c | 2 +- net/ipv4/ip_output.c

[PATCH v2 01/20] xtensa: fix access check in csum_and_copy_from_user

2020-07-23 Thread Al Viro
From: Max Filippov Commit d341659f470b ("xtensa: switch to providing csum_and_copy_from_user()") introduced access check, but incorrectly tested dst instead of src. Fix access_ok argument in csum_and_copy_from_user. Cc: Al Viro Fixes: d341659f470b ("xtensa: swit

[PATCH v2 06/20] csum_and_copy_..._user(): pass 0xffffffff instead of 0 as initial sum

2020-07-23 Thread Al Viro
From: Al Viro Preparation for the change of calling conventions; right now all callers pass 0 as initial sum. Passing 0x instead yields the values comparable mod 0x and guarantees that 0 will not be returned on success. Note that this relies upon the correct behaviour

[PATCH v2 08/20] alpha: propagate the calling convention changes down to csum_partial_copy.c helpers

2020-07-23 Thread Al Viro
From: Al Viro get rid of set_fs() in csum_partial_copy_nocheck(), while we are at it - just take the part of csum_and_copy_from_user() sans the access_ok() check into a helper function and have csum_partial_copy_nocheck() call that. Signed-off-by: Al Viro --- arch/alpha/lib

[PATCH v2 09/20] arm: propagate the calling convention changes down to csum_partial_copy_from_user()

2020-07-23 Thread Al Viro
From: Al Viro ... and get rid of the "clean the destination on error" crap. Simplifies the fault handlers and the function itself... Signed-off-by: Al Viro --- arch/arm/include/asm/checksum.h | 7 ++- arch/arm/lib/csumpartialcopy.S| 1 - ar

[PATCH v2 03/20] icmp_push_reply(): reorder adding the checksum up

2020-07-23 Thread Al Viro
From: Al Viro do csum_partial_copy_nocheck() on the first fragment, then add the rest to it. Equivalent transformation. That was the only caller of csum_partial_copy_nocheck() that might pass it non-zero as the last argument. Signed-off-by: Al Viro --- net/ipv4/icmp.c | 8 1 file

[PATCH v2 12/20] i386: propagate the calling conventions change down to csum_partial_copy_generic()

2020-07-23 Thread Al Viro
From: Al Viro ... and don't bother zeroing destination on error Signed-off-by: Al Viro --- arch/x86/include/asm/checksum_32.h | 18 ++ arch/x86/lib/checksum_32.S | 117 + 2 files changed, 47 insertions(+), 88 deletions(-) diff --git a/arch/x86

[PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-23 Thread Al Viro
From: Al Viro quite a few architectures have the same csum_partial_copy_nocheck() - simply memcpy() the data and then return the csum of the copy. hexagon, parisc, ia64, s390, um: explicitly spelled out that way. arc, arm64, csky, h8300, m68k/nommu, microblaze, mips/GENERIC_CSUM, nds32, nios2

[PATCH v2 10/20] m68k: get rid of zeroing destination on error in csum_and_copy_from_user()

2020-07-23 Thread Al Viro
From: Al Viro Signed-off-by: Al Viro --- arch/m68k/lib/checksum.c | 79 +--- 1 file changed, 15 insertions(+), 64 deletions(-) diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c index 3aeca261f622..7e6afeae6217 100644 --- a/arch/m68k

[PATCH v2 05/20] csum_partial_copy_nocheck(): drop the last argument

2020-07-23 Thread Al Viro
From: Al Viro It's always 0. Note that we could use ~0U as well - result will be the same modulo 0x; later we'll make use of that whenever convenient. Signed-off-by: Al Viro --- arch/alpha/include/asm/checksum.h| 2 +- arch/alpha/lib/csum_partial_copy.c | 4 ++-- arch/arm/include

[PATCH v2 11/20] sh: propage the calling conventions change down to csum_partial_copy_generic()

2020-07-23 Thread Al Viro
From: Al Viro ... and get rid of zeroing destination on error there. Signed-off-by: Al Viro --- arch/sh/include/asm/checksum_32.h | 20 ++- arch/sh/lib/checksum.S| 119 +++--- 2 files changed, 39 insertions(+), 100 deletions(-) diff --git

[PATCH v2 15/20] mips: __csum_partial_copy_kernel() has no users left

2020-07-23 Thread Al Viro
From: Al Viro Signed-off-by: Al Viro --- arch/mips/include/asm/checksum.h | 3 --- arch/mips/lib/csum_partial.S | 3 --- 2 files changed, 6 deletions(-) diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h index 5cf4ce11c821..a8ff9c306363 100644 --- a/arch/mips

[PATCH v2 13/20] sparc32: propagate the calling conventions change down to __csum_partial_copy_sparc_generic()

2020-07-23 Thread Al Viro
From: Al Viro ... and get rid of zeroing the target, etc. on fault. All exception handlers merge into one; moreover, since we are not calling lookup_fault() anymore, we don't need the magic with passing arguments for it from the page fault handler. Acked-by: David S. Miller Signed-off-by: Al

[PATCH v2 16/20] mips: propagate the calling convention change down into __csum_partial_copy_..._user()

2020-07-23 Thread Al Viro
From: Al Viro and turn the exception handlers into simply returning 0, which simplifies the hell out of things in csum_partial.S Signed-off-by: Al Viro --- arch/mips/include/asm/checksum.h | 26 +--- arch/mips/lib/csum_partial.S | 258 +-- 2 files

[PATCH v2 14/20] mips: csum_and_copy_{to,from}_user() are never called under KERNEL_DS

2020-07-23 Thread Al Viro
From: Al Viro they are only called for iovec-backed iov_iter and under KERNEL_DS an attempt to create such a beast will yield a kvec-backed one. Signed-off-by: Al Viro --- arch/mips/include/asm/checksum.h | 32 +++- 1 file changed, 7 insertions(+), 25 deletions

[PATCH v2 20/20] ppc: propagate the calling conventions change down to csum_partial_copy_generic()

2020-07-23 Thread Al Viro
From: Al Viro ... and get rid of the pointless fallback in the wrappers. On error it used to zero the unwritten area and calculate the csum of the entire thing. Not wanting to do it in assembler part had been very reasonable; doing that in the first place, OTOH... In case of an error

[PATCH v2 18/20] sparc64: propagate the calling convention changes down to __csum_partial_copy_...()

2020-07-23 Thread Al Viro
From: Al Viro ... and rename them into csum_and_copy_...() - the wrappers become pointless. [braino fixed] Signed-off-by: Al Viro --- arch/sparc/include/asm/checksum.h| 1 + arch/sparc/include/asm/checksum_32.h | 2 -- arch/sparc/include/asm/checksum_64.h | 41

[PATCH v2 17/20] xtensa: propagate the calling conventions change down into csum_partial_copy_generic()

2020-07-23 Thread Al Viro
From: Al Viro turn the exception handlers into returning 0. Reviewed-by: Max Filippov Tested-by: Max Filippov Signed-off-by: Al Viro --- arch/xtensa/include/asm/checksum.h | 20 +++- arch/xtensa/lib/checksum.S | 67 +- 2 files changed, 19

[PATCH v2 19/20] amd64: switch csum_partial_copy_generic() to new calling conventions

2020-07-23 Thread Al Viro
From: Al Viro ... and fold handling of misaligned case into it. Implementation note: we stash the "will we need to rol8 the sum in the end" flag into the MSB of %rcx (the lower 32 bits are used for length); the rest is pretty straightforward. Signed-off-by: Al Viro --- arch/x86/i

[PATCH v2 07/20] saner calling conventions for csum_and_copy_..._user()

2020-07-23 Thread Al Viro
From: Al Viro All callers of these primitives will * discard anything we might've copied in case of error * ignore the csum value in case of error * always pass 0x as the initial sum, so the resulting csum value (in case of success, that is) will never be 0

[RFC][CFT][PATCHSET v2] saner calling conventions for csum-and-copy primitives

2020-07-23 Thread Al Viro
followups. Shortlog: Al Viro (19): skb_copy_and_csum_bits(): don't bother with the last argument icmp_push_reply(): reorder adding the checksum up unify generic instances of csum_partial_copy_nocheck() csum_partial_copy_nocheck(): drop the last argument csum_and_cop

Re: [RFC][PATCHSET] regset ->get() rework

2020-07-23 Thread Al Viro
On Thu, Jul 23, 2020 at 09:00:29AM +0100, Christoph Hellwig wrote: > Hi Al, > > what's the state of the series? I noticed it hasn't shown up in > linux-next so far. It (as well as fdpic coredump stuff) will go into -next as soon as I post the second variant of csum_and_copy stuff (later today).

Re: [PATCH 04/18] csum_and_copy_..._user(): pass 0xffffffff instead of 0 as initial sum

2020-07-23 Thread Al Viro
On Thu, Jul 23, 2020 at 03:53:42PM +0100, Al Viro wrote: > Said that, what you've printed for 1-byte segments (and that's going to be > seriously affected by the setup costs in csum-copy.S, sensitive to calling > convention changes) is time to run the 16-iteration loop divided by 1 *

<    1   2   3   4   5   6   7   8   9   10   >