lkml.org 
[lkml]   [2020]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: bpfilter logging write errors in dmesg
On Mon, Jul 27, 2020 at 04:50:13PM +0200, Christoph Hellwig wrote:
> Strange. Can you add this additional debugging patch:

Sorry Christoph,

didn't mean to leave you waiting. I got pulled into other stuff.

Christian

>
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 4fb797822567a6..d0a8ada1efd954 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -369,8 +369,10 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t
> int retval = -EINVAL;
>
> inode = file_inode(file);
> - if (unlikely((ssize_t) count < 0))
> + if (unlikely((ssize_t) count < 0)) {
> + printk("count invalid: %zd\n", count);
> return retval;
> + }
>
> /*
> * ranged mandatory locking does not apply to streams - it makes sense
> @@ -380,25 +382,35 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t
> loff_t pos = *ppos;
>
> if (unlikely(pos < 0)) {
> - if (!unsigned_offsets(file))
> + if (!unsigned_offsets(file)) {
> + printk("pos invalid: %lld\n", pos);
> return retval;
> + }
> if (count >= -pos) /* both values are in 0..LLONG_MAX */
> return -EOVERFLOW;
> } else if (unlikely((loff_t) (pos + count) < 0)) {
> - if (!unsigned_offsets(file))
> + if (!unsigned_offsets(file)) {
> + printk("pos+count invalid: %lld, %zd\n", pos, count);
> return retval;
> + }
> }
>
> if (unlikely(inode->i_flctx && mandatory_lock(inode))) {
> retval = locks_mandatory_area(inode, file, pos, pos + count - 1,
> read_write == READ ? F_RDLCK : F_WRLCK);
> - if (retval < 0)
> + if (retval < 0) {
> + if (retval == -EINVAL)
> + printk("locks_mandatory_area\n");
> return retval;
> + }
> }
> }
>
> - return security_file_permission(file,
> + retval = security_file_permission(file,
> read_write == READ ? MAY_READ : MAY_WRITE);
> + if (retval == -EINVAL)
> + printk("security_file_permission\n");
> + return retval;
> }
>
> static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)

\
 
 \ /
  Last update: 2020-07-30 09:10    [W:0.128 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site