lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 29 Apr 2020 14:00:38 +0530
From:   Ritesh Harjani <riteshh@...ux.ibm.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
        Alexander Viro <viro@...iv.linux.org.uk>,
        "Darrick J . Wong" <darrick.wong@...cle.com>,
        Christoph Hellwig <hch@...radead.org>,
        Jan Kara <jack@...e.com>, tytso@....edu,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
        linux-ext4@...r.kernel.org, Jan Kara <jack@...e.cz>,
        Christoph Hellwig <hch@....de>
Subject: Re: [PATCHv2] fibmap: Warn and return an error in case of block >
 INT_MAX



On 4/28/20 5:11 PM, Matthew Wilcox wrote:
> On Tue, Apr 28, 2020 at 01:08:31PM +0530, Ritesh Harjani wrote:
>> @@ -71,6 +72,13 @@ static int ioctl_fibmap(struct file *filp, int __user *p)
>>   	block = ur_block;
>>   	error = bmap(inode, &block);
>>   
>> +	if (block > INT_MAX) {
>> +		error = -ERANGE;
>> +		pr_warn_ratelimited("[%s/%d] FS (%s): would truncate fibmap result\n",
>> +				    current->comm, task_pid_nr(current),
>> +				    sb->s_id);
> 
> Why is it useful to print the pid?
For e.g. a case where you have pthreads. pid could be different there.

> And why print the superblock when we could print the filename instead? > We have a struct file, so we can printk("%pD4", filp) to print the
> last four components of the pathname.
> 

Sure, let me use below print msg then. This should cover everything now
If no objections, I could send this in v3. Pls, do let me know if
otherwise.

Since this has changed again from the 1st version, will drop all
Reviewed-by: and you could directly review v3 then.

		pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap 
result\n",
				    current->comm, task_pid_nr(current),
				    sb->s_id, filp);

About %pD from (Documentation/core-api/printk-formats.rst)
========================================================
<..>
	%pd{,2,3,4}
	%pD{,2,3,4}

For printing dentry name; if we race with :c:func:`d_move`, the name might
be a mix of old and new ones, but it won't oops.  %pd dentry is a safer
equivalent of %s dentry->d_name.name we used to use, %pd<n> prints ``n``
last components.  %pD does the same thing for struct file.



-ritesh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ