lkml.org 
[lkml]   [2019]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4.19 33/75] f2fs: fix to avoid accessing xattr across the boundary
From
Date
Hi Pavel,

On 2019/6/19 20:32, Pavel Machek wrote:
> Hi!
>
>> When we traverse xattr entries via __find_xattr(),
>> if the raw filesystem content is faked or any hardware failure occurs,
>> out-of-bound error can be detected by KASAN.
>> Fix the issue by introducing boundary check.
>
> Ok, so this prevents fs corruption from causing problems,
>
>> @@ -340,7 +347,11 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
>> else
>> cur_addr = txattr_addr;
>>
>> - *xe = __find_xattr(cur_addr, index, len, name);
>> + *xe = __find_xattr(cur_addr, last_txattr_addr, index, len, name);
>> + if (!*xe) {
>> + err = -EFAULT;
>> + goto out;
>> + }
>
> Is -EFAULT suitable here? We do not have userspace passing pointers to us, we
> have fs corruption. -EUNCLEAN?

Oh, right, f2fs uses -EFAULT as error number to indicate filesystem is corrupted
all the time, we need to fix it to follow other generic fs.

>
> Should it do some kind of printk to let the user know fs is corrupted, and mark
> it as needing fsck?

Agreed, let me add it. :)

Thanks,

>
> Thanks,
> Pavel
> .
>

\
 
 \ /
  Last update: 2019-06-20 03:46    [W:0.062 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site