Re: 3.7.10+: BUG Dentry still in use [unmount of cifs cifs]

2013-03-07 Thread Mateusz Guzik
x27;t test it on 3.7.10 kernel but it should work fine. -- Mateusz Guzik diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 1a052c0..345e76b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -91,6 +91,24 @@ struct workqueue_struct *cifsiod_wq; __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZ

Re: [PATCH] prctl: remove one-shot limitation for changing exe link

2016-07-30 Thread Mateusz Guzik
Modifying get_mm_exe_file to retry is trivial and in effect never return NULL is trivial. With arbitrary number of changes allowed this may require some cond_resched() or something. For comments I cc'ed Richard Guy Briggs, who is both an audit person and the author of audit_exe_compare. -- Mateusz Guzik

Re: Is reading from /proc/self/smaps thread-safe?

2016-07-30 Thread Mateusz Guzik
r application this translates into kilobytes of memory which would have to allocated just to hold it, sounds like a non-starter to me. -- Mateusz Guzik

Re: [PACTH v4 1/3] mm, proc: Implement /proc//totmaps

2016-08-31 Thread Mateusz Guzik
string then, like in case of smaps. > > > > Thanks for the testing Jacek! > > I had a look around the corresponding smaps code, but I'm not seeing any > checks, do you know where that check actually is made? > See m_start in f/sproc/task_mmu.c. It not only check for non-null mm, but also tries to bump ->mm_users and only then proceeds to walk the mm. -- Mateusz Guzik

Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct

2018-03-26 Thread Mateusz Guzik
set_mm(). Since we > already have dedicated lock to protect them, it is safe to change back > to down_read. > > Signed-off-by: Yang Shi > Cc: Alexey Dobriyan > Cc: Michal Hocko > Cc: Matthew Wilcox > Cc: Mateusz Guzik > Cc: Cyrill Gorcunov > --- > v1 --&

Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct

2018-03-27 Thread Mateusz Guzik
adding the spinlock for args. The downside is growth of mm_struct. i.e. the code can be refactored to just hold the lock and relock only if necessary (unable to copy to user without faulting) -- Mateusz Guzik

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

2018-03-19 Thread Mateusz Guzik
schedule_work(work); } } +#endif /* * Unnamed block devices are dummy devices used by virtual -- Mateusz Guzik

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Mateusz Guzik
+cc Linus On Sat, Jun 22, 2024 at 06:56:08PM +0800, Xi Ruoyao wrote: > It's cheap to check if the path is empty in the userspace, but expensive > to check if a userspace string is empty from the kernel. So using statx > and AT_EMPTY_PATH to implement fstat is slower than a "native" fstat > call.

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Mateusz Guzik
int ret; struct filename *name; + if (flags == AT_EMPTY_PATH && filename == NULL) + return do_statx_by_fd(...); + name = getname_flags(filename, getname_statx_lookup_flags(flags)); ret = do_statx(dfd, name, flags, mask, buffer); putname(name); and so on Personally I would prefer if fstatx was added instead, fwiw most massaging in the area will be the same regardless. -- Mateusz Guzik

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-23 Thread Mateusz Guzik
On Sun, Jun 23, 2024 at 3:22 AM Xi Ruoyao wrote: > > On Sun, 2024-06-23 at 03:07 +0200, Mateusz Guzik wrote: > > On Sun, Jun 23, 2024 at 2:59 AM Xi Ruoyao wrote: > > > > > > On Sat, 2024-06-22 at 15:41 -0700, Linus Torvalds wrote: > > > > > > >

Re: [PATCH RFC v3 12/13] mm: add SLAB_TYPESAFE_BY_RCU to files_cache

2024-08-12 Thread Mateusz Guzik
On Mon, Aug 12, 2024 at 09:29:16PM -0700, Andrii Nakryiko wrote: > Add RCU protection for file struct's backing memory by adding > SLAB_TYPESAFE_BY_RCU flag to files_cachep. This will allow to locklessly > access struct file's fields under RCU lock protection without having to > take much more expe

Re: [PATCH RFC v3 13/13] uprobes: add speculative lockless VMA to inode resolution

2024-08-12 Thread Mateusz Guzik
On Mon, Aug 12, 2024 at 09:29:17PM -0700, Andrii Nakryiko wrote: > Now that files_cachep is SLAB_TYPESAFE_BY_RCU, we can safely access > vma->vm_file->f_inode lockless only under rcu_read_lock() protection, > attempting uprobe look up speculatively. > > We rely on newly added mmap_lock_speculation

Re: [PATCH RFC v3 13/13] uprobes: add speculative lockless VMA to inode resolution

2024-08-15 Thread Mateusz Guzik
On Tue, Aug 13, 2024 at 08:36:03AM -0700, Suren Baghdasaryan wrote: > On Mon, Aug 12, 2024 at 11:18 PM Mateusz Guzik wrote: > > > > On Mon, Aug 12, 2024 at 09:29:17PM -0700, Andrii Nakryiko wrote: > > > Now that files_cachep is SLAB_TYPESAFE_BY_RCU, we can safely a

Re: [PATCH RFC v3 13/13] uprobes: add speculative lockless VMA to inode resolution

2024-08-15 Thread Mateusz Guzik
On Thu, Aug 15, 2024 at 10:45:45AM -0700, Suren Baghdasaryan wrote: > >From all the above, my understanding of your objection is that > checking mmap_lock during our speculation is too coarse-grained and > you would prefer to use the VMA seq counter to check that the VMA we > are working on is unch

Re: [PATCH RFC v3 13/13] uprobes: add speculative lockless VMA to inode resolution

2024-08-15 Thread Mateusz Guzik
probe lookup will be sufficient, or maybe some other hackery is viable without messing with fences in vma_start_write. -- Mateusz Guzik

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-21 Thread Mateusz Guzik
On Tue, Apr 21, 2015 at 11:05:43AM -0700, Eric Dumazet wrote: > On Mon, 2015-04-20 at 13:49 -0700, Eric Dumazet wrote: > > On Mon, 2015-04-20 at 10:15 -0700, Eric Dumazet wrote: > > > On Mon, 2015-04-20 at 17:10 +0200, Mateusz Guzik wrote: > > > > > > > So

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-21 Thread Mateusz Guzik
On Tue, Apr 21, 2015 at 10:06:24PM +0200, Mateusz Guzik wrote: > On Tue, Apr 21, 2015 at 11:05:43AM -0700, Eric Dumazet wrote: > > On Mon, 2015-04-20 at 13:49 -0700, Eric Dumazet wrote: > > > On Mon, 2015-04-20 at 10:15 -0700, Eric Dumazet wrote: > > > > On Mon, 2015

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-22 Thread Mateusz Guzik
On Tue, Apr 21, 2015 at 02:06:53PM -0700, Eric Dumazet wrote: > On Tue, 2015-04-21 at 22:12 +0200, Mateusz Guzik wrote: > > > in dup_fd: > >for (i = open_files; i != 0; i--) { > > struct file *f = *old_fds++; &

[PATCH] fs/file.c: remove useless xchg and NULL check in close_files

2015-04-14 Thread Mateusz Guzik
Since the table is about to be freed, there is no reason to set file pointer to NULL on closing. At this point open_fd map is supposed to indicate whether a file is installed, so NULL-checking it is unnecessary. Signed-off-by: Mateusz Guzik --- fs/file.c | 7 ++- 1 file changed, 2

[RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-16 Thread Mateusz Guzik
o ensure we updated the right table. Signed-off-by: Mateusz Guzik --- fs/file.c | 24 +++- include/linux/fdtable.h | 5 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/fs/file.c b/fs/file.c index 93c5f89..bd1ef4c 100644 --- a/fs/file.c

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-16 Thread Mateusz Guzik
On Thu, Apr 16, 2015 at 01:55:39PM -0700, Eric Dumazet wrote: > On Thu, 2015-04-16 at 13:42 -0700, Eric Dumazet wrote: > > On Thu, 2015-04-16 at 19:09 +0100, Al Viro wrote: > > > On Thu, Apr 16, 2015 at 02:16:31PM +0200, Mateusz Guzik wrote: > > > > @@ -165,8 +165,1

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-16 Thread Mateusz Guzik
On Thu, Apr 16, 2015 at 07:09:32PM +0100, Al Viro wrote: > On Thu, Apr 16, 2015 at 02:16:31PM +0200, Mateusz Guzik wrote: > > @@ -165,8 +165,10 @@ static int expand_fdtable(struct files_struct *files, > > int nr) > > cur_fdt = files_fdtable(files); > >

Re: [PATCH] fs/file.c: don't acquire files->file_lock in fd_install()

2015-04-27 Thread Mateusz Guzik
On Tue, Apr 21, 2015 at 09:59:28PM -0700, Eric Dumazet wrote: > From: Eric Dumazet > > Mateusz Guzik reported : > > Currently obtaining a new file descriptor results in locking fdtable > twice - once in order to reserve a slot and second time to fill it. > >

Re: [RFC PATCH RESEND] vfs: Move security_inode_killpriv() after permission checks

2015-04-08 Thread Mateusz Guzik
; > if (iattr->ia_valid & ATTR_SIZE) { > xfs_ilock(ip, XFS_IOLOCK_EXCL); > - error = xfs_setattr_size(ip, iattr); > + error = xfs_setattr_size(dentry, ip, iattr); > xfs_iunlock(ip, XFS_IOLOCK_EXCL); > } else { > - error = xfs_setattr_nonsize(ip, iattr, 0); > + error = xfs_setattr_nonsize(dentry, ip, iattr, 0); > } > > return error; > diff --git a/fs/xfs/xfs_iops.h b/fs/xfs/xfs_iops.h > index 1c34e43..6994d3e 100644 > --- a/fs/xfs/xfs_iops.h > +++ b/fs/xfs/xfs_iops.h > @@ -32,8 +32,14 @@ extern void xfs_setup_inode(struct xfs_inode *); > */ > #define XFS_ATTR_NOACL 0x01/* Don't call posix_acl_chmod */ > > -extern int xfs_setattr_nonsize(struct xfs_inode *ip, struct iattr *vap, > +/* > + * XXX Several callers have to pass dentry = NULL and this should > + * work but it's really ugly. > + */ > +extern int xfs_setattr_nonsize(struct dentry *dentry, > +struct xfs_inode *ip, struct iattr *vap, > int flags); > -extern int xfs_setattr_size(struct xfs_inode *ip, struct iattr *vap); > +extern int xfs_setattr_size(struct dentry *dentry, > + struct xfs_inode *ip, struct iattr *vap); > > #endif /* __XFS_IOPS_H__ */ > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 9ab779e..7cad5d1 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -2663,6 +2663,7 @@ extern int buffer_migrate_page(struct address_space *, > extern int inode_change_ok(const struct inode *, struct iattr *); > extern int inode_newsize_ok(const struct inode *, loff_t offset); > extern void setattr_copy(struct inode *inode, const struct iattr *attr); > +extern int setattr_killpriv(struct dentry *dentry, struct iattr *attr); > > extern int file_update_time(struct file *file); > > diff --git a/mm/shmem.c b/mm/shmem.c > index 185836b..d1d4b9b 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -557,6 +557,10 @@ static int shmem_setattr(struct dentry *dentry, struct > iattr *attr) > if (error) > return error; > > + error = setattr_killpriv(dentry, attr); > + if (error) > + return error; > + > if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { > loff_t oldsize = inode->i_size; > loff_t newsize = attr->ia_size; > > > -- > Ben Hutchings > The first rule of tautology club is the first rule of tautology club. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH 2/2] Fix variable "error" missing initialization

2015-04-29 Thread Mateusz Guzik
way which can interrupt the loop upcoming loop before it gets the chance to set error. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-17 Thread Mateusz Guzik
On Fri, Apr 17, 2015 at 02:46:56PM -0700, Eric Dumazet wrote: > On Thu, 2015-04-16 at 14:16 +0200, Mateusz Guzik wrote: > > Hi, > > > > Currently obtaining a new file descriptor results in locking fdtable > > twice - once in order to reserve a slot

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-20 Thread Mateusz Guzik
On Sat, Apr 18, 2015 at 12:02:52AM +0100, Al Viro wrote: > On Sat, Apr 18, 2015 at 12:16:48AM +0200, Mateusz Guzik wrote: > > > I would say this makes the use of seq counter impossible. Even if we > > decided to fall back to a lock on retry, we cannot know what to do if > &

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-20 Thread Mateusz Guzik
On Sat, Apr 18, 2015 at 12:41:38PM -0700, Eric Dumazet wrote: > On Sat, 2015-04-18 at 00:02 +0100, Al Viro wrote: > > On Sat, Apr 18, 2015 at 12:16:48AM +0200, Mateusz Guzik wrote: > > > > > I would say this makes the use of seq counter impossible. Even if we > > &g

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-20 Thread Mateusz Guzik
On Mon, Apr 20, 2015 at 03:06:33PM +0200, Mateusz Guzik wrote: > On Sat, Apr 18, 2015 at 12:02:52AM +0100, Al Viro wrote: > > On Sat, Apr 18, 2015 at 12:16:48AM +0200, Mateusz Guzik wrote: > > > > > I would say this makes the use of seq counter impossible. Even if we >

Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install

2015-04-20 Thread Mateusz Guzik
On Mon, Apr 20, 2015 at 03:43:26PM +0200, Mateusz Guzik wrote: > On Mon, Apr 20, 2015 at 03:06:33PM +0200, Mateusz Guzik wrote: > > On Sat, Apr 18, 2015 at 12:02:52AM +0100, Al Viro wrote: > > > On Sat, Apr 18, 2015 at 12:16:48AM +0200, Mateusz Guzik wrote: > > > >

Re: [RFC PATCH RESEND] vfs: Move security_inode_killpriv() after permission checks

2015-06-03 Thread Mateusz Guzik
On Mon, Apr 13, 2015 at 11:39:01AM +1000, James Morris wrote: > On Wed, 8 Apr 2015, Mateusz Guzik wrote: > > > This is still a problem. Any feedback about the patch? > > > > I'd like to see feedback from vfs folk (Al). > Ping? Are there any concerns with the

[PATCH] kref: oops on zero or negative refcount

2014-02-20 Thread Mateusz Guzik
underflow. Signed-off-by: Mateusz Guzik Cc: Rik van Riel --- include/linux/kref.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/kref.h b/include/linux/kref.h index 484604d..c3f8a0a 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -43,8 +43,10

Re: [PATCH] kref: oops on zero or negative refcount

2014-02-21 Thread Mateusz Guzik
On Thu, Feb 20, 2014 at 01:14:40PM -0500, Dave Jones wrote: > On Thu, Feb 20, 2014 at 06:44:59PM +0100, Mateusz Guzik wrote: > > In use after free situations, it is possible for one thread to write to > > memory that has just been reallocated to a new user. This could open up

Re: [RFC PATCH] cmdline: Hide "debug" from /proc/cmdline

2014-04-02 Thread Mateusz Guzik
e kernel is booted with "debug"? If there is a real need to pass arguments to systemd, how about a dedicated option (initargs= or whatever, where it has to be last in cmdline), then systemd would be spawned with these arguments and would just go over its argv. -- Mateusz

Re: [PATCH] mm/swap: fix race on swap_info reuse between swapoff and swapon

2014-01-12 Thread Mateusz Guzik
if (!p->swap_map[offset]) goto bad_free; so that would need a trivial adjustment. Another nit is that swap_start and swap_next do the following: if (!(si->flags & SWP_USED) || !si->swap_map) continue; Testing for swap_map does not look very nice

[PATCH] ipc: fix compat msgrcv with negative msgtyp

2014-01-15 Thread Mateusz Guzik
Compat function takes msgtyp argument as u32 and passes it down to do_msgrcv which results in casting to long, thus the sign is lost and we get a big positive number instead. Cast the argument to signed type before passing it down. Signed-off-by: Mateusz Guzik Reported-by: Gabriellla Schmidt

Re: disappearing listen()ed SO_REUSEPORT sockets across fork() when using epoll

2013-11-25 Thread Mateusz Guzik
On Mon, Nov 25, 2013 at 11:53:24AM -0800, Shawn Landden wrote: > On Mon, Nov 25, 2013 at 10:05 AM, Jason Baron wrote: > > On 11/22/2013 12:53 PM, Shawn Landden wrote: > >> Hello, when running the attached program on 3.12 child processes > >> are missing a socket fd opened, set with SO_REUSEPORT, l

Re: [PATCH] vfs: Don't exchange filenames unconditionally.

2014-09-18 Thread Mateusz Guzik
uct dentry *anon) > > dparent = dentry->d_parent; > > - switch_names(dentry, anon); > + switch_names(dentry, anon, false); > swap(dentry->d_name.hash, anon->d_name.hash); > > dentry->d_parent = dentry; > -- > 1.8.5.5 > &

Re: [RESEND][PATCHv2 1/2] procfs: show hierarchy of pid namespace

2014-09-22 Thread Mateusz Guzik
gt; + if (ns == curr_ns) > + curr_level = curr_ns->level; > + > + if (curr_level == -1) > + continue; > + > + for (i = curr_level + 1; i <= pid->level; i++) { > +

Re: [PATCHv3 1/2] procfs: show hierarchy of pid namespace

2014-09-24 Thread Mateusz Guzik
r_level == -1) > + continue; > + > + for (i = curr_level + 1; i <= pid->level; i++) { > + ns = pid->numbers[i].ns; > + /* show PID '1' in specific pid ns */ > + snprintf(pid_buf, 32, "/proc/%u/ns/pid&quo

Re: /proc//exe symlink behavior change in >=3.15.

2014-09-11 Thread Mateusz Guzik
On Thu, Sep 11, 2014 at 06:39:58PM -0500, Chuck Ebbert wrote: > On Sun, 7 Sep 2014 09:56:08 +0200 > Mateusz Guzik wrote: > > > On Sat, Sep 06, 2014 at 11:44:32PM +0200, Piotr Karbowski wrote: > > > Hi, > > > > > > Starting with kernel 3.15 the '

Re: Clarification needed on use of put_user inside a loop

2014-04-25 Thread Mateusz Guzik
change anything for those consumers, it seems to be a bug to not include it. Thus I suggest adding access_ok variant which calls might_fault. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kern

Re: [PATCH] drm: make variable named "refcount" atomic, like most refcounts in the kernel.

2014-04-26 Thread Mateusz Guzik
or can be used, there is clearly no reason to use mere atomic ops. It may be that kernel devs would accept a patch implementing generic refcount manipulation primitives without atomicity guarantees, which could be used in cases like this. Then atomic and non-atomic versions could be used to detect o

Re: [PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Mateusz Guzik
sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name, > dev_name(line6->ifcdev)); Would not it be better to return -EINVAL (or some other error) instead? Now you will possibly truncate the name. -- Mateusz Guzik -- To unsubscribe from this

Re: [PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Mateusz Guzik
On Sun, Apr 27, 2014 at 12:36:21AM +0300, Dan Carpenter wrote: > On Sat, Apr 26, 2014 at 10:47:05PM +0200, Mateusz Guzik wrote: > > On Sat, Apr 26, 2014 at 07:09:22PM +0200, Laurent Navet wrote: > > > The strcpy operation may write past the end of the fixed-size destination &

Re: [PATCH] drm: make variable named "refcount" atomic, like most refcounts in the kernel.

2014-04-26 Thread Mateusz Guzik
wards is not a problem for them. That is provided there is enough hand-coded refcount code, if this would be the only consumer (which will most likely never leak anyway) then this is defnitely not worth it. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kerne

Re: [PATCH] staging: line6: fix possible overrun

2014-04-27 Thread Mateusz Guzik
On Sun, Apr 27, 2014 at 08:39:32PM +0300, Dan Carpenter wrote: > On Sat, Apr 26, 2014 at 11:59:46PM +0200, Mateusz Guzik wrote: > > > And sadly enough some of those ->id strings are more than 15 characters > > > and a NUL which will fit in card->id. So this overfl

Re: [PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-15 Thread Mateusz Guzik
On Fri, May 16, 2014 at 08:21:35AM +1000, Dave Chinner wrote: > On Thu, May 15, 2014 at 12:47:48PM +0200, Mateusz Guzik wrote: > > On Thu, May 15, 2014 at 12:40:19PM +0200, Lukáš Czerner wrote: > > > On Wed, 14 May 2014, Eric Sandeen wrote: > > > > > > >

Re: [PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-15 Thread Mateusz Guzik
On Fri, May 16, 2014 at 08:51:41AM +1000, Dave Chinner wrote: > On Fri, May 16, 2014 at 12:34:40AM +0200, Mateusz Guzik wrote: > > On Fri, May 16, 2014 at 08:21:35AM +1000, Dave Chinner wrote: > > > > IOW, a new column in mountinfo. For frozen filesystems it would contain &

Re: [PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-15 Thread Mateusz Guzik
On Fri, May 16, 2014 at 10:11:56AM +1000, Dave Chinner wrote: > On Fri, May 16, 2014 at 01:19:09AM +0200, Mateusz Guzik wrote: > > Except there is no log entry if /var got frozen (and this is not an > > imaginary example). > > Freezing the filesystem that the freezing daemo

Re: [PATCH] kref: warn on uninitialized kref

2014-05-17 Thread Mateusz Guzik
mutex_lock(lock); > if (unlikely(!atomic_dec_and_test(&kref->refcount))) { This has a side effect of detecting some overputs, which is nice. However, could be made better if kref_sub checked that refs you want to take don't put the count below 0. i.e. WARN_ON(count &

Re: [PATCH] fs: Cleanup string initializations (char[] instead of char *)

2014-05-17 Thread Mateusz Guzik
_bit(Enabled, &e->flags)) > status = "enabled"; This particular function would be better of with removing this variable and replacing all pairs like: sprintf(dp, ...); dp += strlen(...) with: dp += sprintf(dp, ...); -- Mateusz Guzik -- To unsubscribe from this

Re: [PATCH] i2c: busses: i2c-pxa.c: Fix for possible null pointer dereference

2014-05-17 Thread Mateusz Guzik
rect. request_mem_region, which I believe is a prerequisite for this function may not be called when you jump here. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] fs: Cleanup string initializations (char[] instead of char *)

2014-05-17 Thread Mateusz Guzik
On Sat, May 17, 2014 at 06:21:09PM +0100, Al Viro wrote: > On Sat, May 17, 2014 at 05:44:28PM +0200, Mateusz Guzik wrote: > > This particular function would be better of with removing this variable > > and replacing all pairs like: > > sprintf(dp, ...); > > dp += strlen

[PATCH] aio: simplify exit_aio

2014-02-18 Thread Mateusz Guzik
-by: Mateusz Guzik --- fs/aio.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 062a5f6..0701181 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -766,38 +766,35 @@ void exit_aio(struct mm_struct *mm) { struct kioctx_ta

Re: [PATCH] staging: line6: fix possible overrun

2014-04-29 Thread Mateusz Guzik
On Tue, Apr 29, 2014 at 04:47:11PM +0200, Takashi Iwai wrote: > At Mon, 28 Apr 2014 01:44:25 +0300, > Dan Carpenter wrote: > > > > On Sun, Apr 27, 2014 at 10:00:43PM +0200, Mateusz Guzik wrote: > > > > > and a WARN_ON + -EINVAL in line6_init_audio to

Re: [PATCH 1/1] aio: change exit_aio() to load mm->ioctx_table once and avoid rcu_read_lock()

2014-04-29 Thread Mateusz Guzik
eeing, but that is nod one and not every pointer is nullified anyway. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] aio: fix potential leak in aio_run_iocb().

2014-04-30 Thread Mateusz Guzik
y semantics of rw_copy_check_uvector so that it frees stuff on error, taking care of this case as well: https://lkml.org/lkml/2014/4/25/778 -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More

Re: [PATCH] staging: rtl8723au: fix potential leak in update_bcn_wps_ie()

2014-05-01 Thread Mateusz Guzik
pmlmepriv->wps_beacon_ie; if (pwps_ie_src == NULL) return; Maybe just check pwps_ie_src earlier? -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More maj

Re: [PATCH 1/1] mm/zswap.c: add lock helper

2014-05-02 Thread Mateusz Guzik
On Fri, May 02, 2014 at 06:35:10PM +0200, Fabian Frederick wrote: > &tree->lock is used all over the place > [..] > + spinlock_t *lock = &tree->lock; > > if (!tree) > return; > Rather fishy, although I'm unsure if this is

[PATCH 1/2] fs: include device name in error messages about freezing

2014-05-13 Thread Mateusz Guzik
While here use pr_err instead of printk(KERN_ERR...) Signed-off-by: Mateusz Guzik Cc: linux-fsde...@vger.kernel.org Cc: Josef Bacik Cc: Jan Kara Cc: Al Viro Cc: Eric Sandeen --- fs/super.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/super.c b/fs/super.c

[PATCH 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-13 Thread Mateusz Guzik
This helps hang troubleshooting efforts when only dmesg is available. Signed-off-by: Mateusz Guzik Cc: linux-fsde...@vger.kernel.org Cc: Josef Bacik Cc: Jan Kara Cc: Al Viro Cc: Eric Sandeen --- fs/super.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs

Re: [PATCH 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-13 Thread Mateusz Guzik
On Tue, May 13, 2014 at 11:39:31AM -0700, Joe Perches wrote: > On Tue, 2014-05-13 at 20:31 +0200, Mateusz Guzik wrote: > > This helps hang troubleshooting efforts when only dmesg is available. > [] > > diff --git a/fs/super.c b/fs/super.c > [] > > @@ -1289,12 +1289,9

Re: [PATCH 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-13 Thread Mateusz Guzik
On Tue, May 13, 2014 at 12:00:21PM -0700, Joe Perches wrote: > On Tue, 2014-05-13 at 20:53 +0200, Mateusz Guzik wrote: > > This is the same code which you can find at the end of the function. > > I added the label so that I can write freeze printk only once. > > Yes

[PATCH V2 1/2] fs: include device name in error messages about freezing

2014-05-13 Thread Mateusz Guzik
While here use pr_err instead of printk(KERN_ERR...) Signed-off-by: Mateusz Guzik Cc: linux-fsde...@vger.kernel.org Cc: Josef Bacik Cc: Jan Kara Cc: Al Viro Cc: Eric Sandeen --- fs/super.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/super.c b/fs/super.c

[PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-13 Thread Mateusz Guzik
This helps hang troubleshooting efforts when only dmesg is available. While here remove code duplication with MS_RDONLY case and fix a whitespace nit. Signed-off-by: Mateusz Guzik Cc: linux-fsde...@vger.kernel.org Cc: Josef Bacik Cc: Jan Kara Cc: Al Viro Cc: Eric Sandeen Cc: Joe Perches

Re: [PATCH v2] x86: kaslr to avoid setup_data regions

2014-05-14 Thread Mateusz Guzik
mem_avoid[mem_avoid_nr].size = sizeof(*data) + > data->len; > + mem_avoid_nr++; > + } > + pa_data = data->next; > + } > +} > + I have no idea if this real_mode->hdr.setup_data examination is correct, so not commenting on that. Wh

Re: [PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-14 Thread Mateusz Guzik
On Wed, May 14, 2014 at 01:14:49PM +0200, Jan Kara wrote: > On Wed 14-05-14 00:04:43, Mateusz Guzik wrote: > > This helps hang troubleshooting efforts when only dmesg is available. > > > > While here remove code duplication with MS_RDONLY case and fix a > > white

Re: [PATCH 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-15 Thread Mateusz Guzik
On Thu, May 15, 2014 at 07:54:57AM +1000, Dave Chinner wrote: > On Tue, May 13, 2014 at 08:31:02PM +0200, Mateusz Guzik wrote: > > This helps hang troubleshooting efforts when only dmesg is available. > > I really don't think that spamming dmesg every time a filesystem is >

Re: [PATCH V2 2/2] fs: print a message when freezing/unfreezing filesystems

2014-05-15 Thread Mateusz Guzik
On Thu, May 15, 2014 at 12:40:19PM +0200, Lukáš Czerner wrote: > On Wed, 14 May 2014, Eric Sandeen wrote: > > > Date: Wed, 14 May 2014 17:40:22 -0500 > > From: Eric Sandeen > > Reply-To: sand...@redhat.com > > To: Dave Chinner , Jan Kara > > Cc: Mateusz

Re: WARN in do_rt_tgsigqueueinfo()

2014-05-15 Thread Mateusz Guzik
64036] ---[ end trace 02450728e2526283 ]--- > > > This is apparently a very common thing to hit according to google. Well, it warns about an argument received from userland, so nothing fishy going on as far as kernel consistency is concerned if that's what you mean. -- Mateusz G

Re: WARN in do_rt_tgsigqueueinfo()

2014-05-15 Thread Mateusz Guzik
inion that a user-triggerable WARN is a bug, but aparently > not everyone else feels that way. > imho warning sysadmins about userspace using deprecated stuff is fine as long as users are not able to spam the console with it. Warning reported here just looks scary and provides no informat

Re: [PATCH] net: ipv4: current group_info should be put after using.

2014-05-11 Thread Mateusz Guzik
01:00 2011 +0000 net: ipv4: add IPPROTO_ICMP socket kind starting with 3.0. Thanks, -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [RFC][PATCH] vfs: add closefrom(2) syscall

2014-04-08 Thread Mateusz Guzik
but you never reload the pointer, thus this looks like use-after-free 2. most of this looks like __close_fd, maybe some parts could be moved to an inline function so that code duplication is reduced? -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kerne

Re: [PATCH] net: ipv4: current group_info should be put after using.

2014-04-11 Thread Mateusz Guzik
} > > - return -EACCES; > + ret = -EACCES; > + > +out_release_group: > + put_group_info(group_info); > + return ret; > } > EXPORT_SYMBOL_GPL(ping_init_sock); > -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] net: ipv4: current group_info should be put after using.

2014-04-11 Thread Mateusz Guzik
On Fri, Apr 11, 2014 at 10:35:33AM +0200, Mateusz Guzik wrote: > On Fri, Apr 11, 2014 at 01:37:08PM -0400, Wang, Xiaoming wrote: > > There is a memory leak in ping. Current group_info had been got in > > ping_init_sock and group_info->usage increased. > > But the usage h

Re: [PATCH] net: ipv4: current group_info should be put after using.

2014-04-11 Thread Mateusz Guzik
t. While here move grabbing the reference to a place where it is actually needed. Please cc: me if you resend the patch. Thanks, -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.k

Re: [PATCH v2] hid-appleir: Fix kernel panic due to null pointer

2014-06-30 Thread Mateusz Guzik
s > elements. > But where the claim of 'null pointer' is coming from (or reading/writing past the array for that matter)? Replacing appleir_key_table with appleir->keymap is a noop anyway because: unsigned short keymap[ARRAY_SIZE(appleir_key_table)]; although one may argue is s

Re: lib/argv_split.c : should argv be kfree'ed ?

2014-06-28 Thread Mateusz Guzik
r **argv_split(gfp_t gfp, const char *str, int *argcp) > *argv++ = argv_str; > } > } > + kfree (argv); > *argv = NULL; > > if (argcp) > No, see argv_free. -- Mateusz Guzik -- To unsubscribe from this l

Re: lib/argv_split.c : should argv be kfree'ed ?

2014-06-29 Thread Mateusz Guzik
On Sun, Jun 29, 2014 at 04:40:17PM +0200, Toralf Förster wrote: > On 06/29/2014 12:04 AM, Mateusz Guzik wrote: > > On Sat, Jun 28, 2014 at 11:52:37PM +0200, Toralf Förster wrote: > >> /me wonders if this patch is needed here : > >> > >> > >> dif

[PATCH] NFS: populate ->net in mount data when remounting

2014-06-10 Thread Mateusz Guzik
Otherwise the kernel oopses when remounting with IPv6 server because net is dereferenced in dev_get_by_name. Use net ns of current thread so that dev_get_by_name does not operate on foreign ns. Changing the address is prohibited anyway so this should not affect anything. Signed-off-by: Mateusz

[PATCH] sched: fix possible divide by zero in avg_atom calculation

2014-06-14 Thread Mateusz Guzik
calculations of avg_atom for big nr_switches are now correct. Signed-off-by: Mateusz Guzik Cc: Ingo Molnar Cc: Peter Zijlstra Cc: sta...@vger.kernel.org --- kernel/sched/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index

Re: [PATCH] Check for Null return from logfs_readpage_nolock in btree_write_block

2014-06-16 Thread Mateusz Guzik
le-test your changes. Instructions how to compile the kernel can be found here: http://kernelnewbies.org/FAQ/KernelCompilation I would also suggest letting the patch wait few hours and have another look before sending. Cheers, -- Mateusz Guzik -- To unsubscribe from this list: send the line &

Re: [PATCH] fs: clear close-on-exec flag as part of put_unused_fd()

2013-12-11 Thread Mateusz Guzik
spin_unlock(&files->file_lock); > > if (tofree) >From my reading this will break at least the following: fd = open(..., .. | O_CLOEXEC); dup2(whatever, fd); now fd has O_CLOEXEC even though it should not -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[PATCH 3.10] aio: restore locking of ioctx list on removal

2013-12-05 Thread Mateusz Guzik
io: convert the ioctx list to table lookup v3". Fix the problem by restoring appropriate locking. Signed-off-by: Mateusz Guzik Reported-by: Eryu Guan Cc: Jeff Moyer Cc: Kent Overstreet Cc: linux-...@kvack.org Cc: linux-kernel@vger.kernel.org --- fs/aio.c | 10 ++ 1 file changed

Re: [PATCH 3.10] aio: restore locking of ioctx list on removal

2013-12-06 Thread Mateusz Guzik
On Thu, Dec 05, 2013 at 05:03:47PM -0800, Greg KH wrote: > On Thu, Dec 05, 2013 at 11:09:02AM +0100, Mateusz Guzik wrote: > > Commit 36f5588905c10a8c4568a210d601fe8c3c27e0f0 > > "aio: refcounting cleanup" resulted in ioctx_lock not being held > > during ctx removal,

Re: [RFC][PATCH 3/3] audit: Audit proc cmdline value

2014-01-06 Thread Mateusz Guzik
, which I believe will be the case when someone jokingly unmaps the area (all maybe when it is swapped out but can't be swapped in due to I/O errors). Also since you are just putting 0 in there anyway I don't see much point in testing for it. > + context->cmdline = buf;

Re: /proc//exe symlink behavior change in >=3.15.

2014-09-07 Thread Mateusz Guzik
to be a requirement for cross-rename to work. At least restoring previous behaviour while keeping cross-rename is not hard, I can write it later. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v2 1/1] vfs: Respect MS_RDONLY at bind mount creation

2014-08-01 Thread Mateusz Guzik
ass down info about rdonly request to copy_tree/clone_mnt (perhaps CL_MOUNT_RDONLY flag or a separate flags argument) and handle it there? This would avoid fishy-looking traversal before graft_tree, which even if correct should not be necessary. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v3 1/1] vfs: Respect MS_RDONLY at bind mount creation

2014-08-02 Thread Mateusz Guzik
+#define CL_MAKE_SHARED 0x008 > +#define CL_PRIVATE 0x010 > +#define CL_SHARED_TO_SLAVE 0x020 > +#define CL_UNPRIVILEGED 0x040 > +#define CL_COPY_MNT_NS_FILE 0x080 > +#define CL_MAKE_RDONLY 0x100 > > #define CL_COPY_ALL (CL_COPY_UNBINDABLE | CL_COPY_MNT_NS_FILE) > > -- > 1.8.5.5 > -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] scatterlist.h: Change CONFIG_DEBUG_SG for ifdef statement in sg_set_bf

2014-08-02 Thread Mateusz Guzik
d compiling this? IIRC you said you would compile your stuff, what hapened to that? What exactly were you trying to achieve? Did this BUG_ON detect a problem on your system and now you are trying to silence it? The change would be wrong even if it compiled since it would just execute the ass

Re: [PATCH] scatterlist.h: Change CONFIG_DEBUG_SG for ifdef statement in sg_set_bf

2014-08-02 Thread Mateusz Guzik
On Sun, Aug 03, 2014 at 12:31:30AM -0400, Nick Krause wrote: > On Sat, Aug 2, 2014 at 11:59 PM, Mateusz Guzik wrote: > > On Sat, Aug 02, 2014 at 10:56:13PM -0400, Nicholas Krause wrote: > >> This changes the ifdef statement in sg_set_bg to !CONFIG_DEBUG_SG in order > >&g

Re: [PATCH] scatterlist.h: Change CONFIG_DEBUG_SG for ifdef statement in sg_set_bf

2014-08-03 Thread Mateusz Guzik
give you a chance to improve. Example programs you can write for fun: - a tcp proxy using poll, epoll and select. backend can be chosen at startup. implement everything yourself, do not use wrappers - a simple shell supporting output redirection and pipes - pick your favourite utility from and imple

Re: [PATCH] xhci: Merge and Update debugging for patches from 3.6 kernel tree

2014-08-05 Thread Mateusz Guzik
ing a working patch is. Forward porting, like this one, demands that you: - understand the patch as applied to the original tree - understand current state of the tree and how it influences the patch As such, foward porting is typically not a task for beginners. I can only recommend

Re: [PATCH 1/2v6] procfs: show hierarchy of pid namespace

2014-11-05 Thread Mateusz Guzik
snprintf(pid_buf, 16, "%u", > + pid_vnr(find_pid_ns(1, ns))); > + seq_printf(m, "%s ", pid_buf); > + } > + > + seq_putc(m, '\n'); > + } > + > + free_pidn

Re: [PATCH] gpu: drm: drm_dp_mst_topology.c: Fix improper use of strncat.

2014-10-05 Thread Mateusz Guzik
ort->port_num); > - strncat(proppath, temp, 255); > + snprintf(&proppath[(len < proppath_len ? len : 0)], proppath_len - len, > + "-%d", port->port_num); > } > > static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,

Re: [PATCH] fs: add the FIGETFROZEN ioctl call

2016-04-14 Thread Mateusz Guzik
such, maybe the feature you are looking for would count how many times the fs is frozen. -- Mateusz Guzik

Re: [PATCH] proc: prevent accessing /proc//environ until it's ready

2016-04-28 Thread Mateusz Guzik
|| !mm->env_end) > return 0; > > page = (char *)__get_free_page(GFP_TEMPORARY); In this case get_cmdline in mm/util.c should also be patched for completness. It tests for arg_end, but later accesses env_end. -- Mateusz Guzik

Re: linux-next: Tree for May 2 [WARNING: at fs/dcache.c]

2016-05-02 Thread Mateusz Guzik
0x0800 /* being looked up (with parent locked shared) */ Verified with switching one to 0x1000 and the warning went away. -- Mateusz Guzik

[PATCH] rlimit: locking tidy ups

2016-05-04 Thread Mateusz Guzik
d: - do_prlimit: stop taking tasklist_lock at all and only lock sighand when necessary - proc_pid_limits: lock group leader in order to obtain a stable copy Signed-off-by: Mateusz Guzik --- fs/proc/base.c | 6 ++ kernel/sys.c | 22 ++

  1   2   >