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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a6bb772-901a-4054-80fa-7ff7cb118944@kernel.org>
Date: Tue, 13 May 2025 10:44:53 +0800
From: Chao Yu <chao@...nel.org>
To: Jaegeuk Kim <jaegeuk@...nel.org>, g@...gle.com
Cc: chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] f2fs: add f2fs_bug_on() to detect potential bug

On 5/12/25 23:26, Jaegeuk Kim wrote:
> On 05/12, Chao Yu wrote:
>> Add f2fs_bug_on() to check whether memory preallocation will fail or
>> not after radix_tree_preload(GFP_NOFS | __GFP_NOFAIL).
> 
> Are we getting a bug?

No, I'm worried about potential issue from add_free_nid() can cause
node footer corruption issue, so I want to use f2fs_bug_on() to check
whether there is caused by any bug from MM from now on.

Thanks,

> 
>>
>> Signed-off-by: Chao Yu <chao@...nel.org>
>> ---
>>  fs/f2fs/checkpoint.c | 4 +++-
>>  fs/f2fs/node.c       | 7 +++++--
>>  2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index e7907858eb70..3f223bade520 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -504,6 +504,7 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino,
>>  {
>>  	struct inode_management *im = &sbi->im[type];
>>  	struct ino_entry *e = NULL, *new = NULL;
>> +	int ret;
>>  
>>  	if (type == FLUSH_INO) {
>>  		rcu_read_lock();
>> @@ -516,7 +517,8 @@ static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino,
>>  		new = f2fs_kmem_cache_alloc(ino_entry_slab,
>>  						GFP_NOFS, true, NULL);
>>  
>> -	radix_tree_preload(GFP_NOFS | __GFP_NOFAIL);
>> +	ret = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL);
>> +	f2fs_bug_on(sbi, ret);
>>  
>>  	spin_lock(&im->ino_lock);
>>  	e = radix_tree_lookup(&im->ino_root, ino);
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 3f6b8037d25f..88d3032236cb 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -2309,7 +2309,7 @@ static bool add_free_nid(struct f2fs_sb_info *sbi,
>>  	struct f2fs_nm_info *nm_i = NM_I(sbi);
>>  	struct free_nid *i, *e;
>>  	struct nat_entry *ne;
>> -	int err = -EINVAL;
>> +	int err;
>>  	bool ret = false;
>>  
>>  	/* 0 nid should not be used */
>> @@ -2323,7 +2323,10 @@ static bool add_free_nid(struct f2fs_sb_info *sbi,
>>  	i->nid = nid;
>>  	i->state = FREE_NID;
>>  
>> -	radix_tree_preload(GFP_NOFS | __GFP_NOFAIL);
>> +	err = radix_tree_preload(GFP_NOFS | __GFP_NOFAIL);
>> +	f2fs_bug_on(sbi, err);
>> +
>> +	err = -EINVAL;
>>  
>>  	spin_lock(&nm_i->nid_list_lock);
>>  
>> -- 
>> 2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ