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] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Mar 2024 18:41:48 +0530
From: Disha Goel <disgoel@...ux.ibm.com>
To: Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: Avoid excessive credit estimate in ext4_tmpfile()

On 07/03/24 5:23 pm, Jan Kara wrote:

> A user with minimum journal size (1024 blocks these days) complained
> about the following error triggered by generic/697 test in
> ext4_tmpfile():
>
> run fstests generic/697 at 2024-02-28 05:34:46
> JBD2: vfstest wants too many credits credits:260 rsv_credits:0 max:256
> EXT4-fs error (device loop0) in __ext4_new_inode:1083: error 28
>
> Indeed the credit estimate in ext4_tmpfile() is huge.
> EXT4_MAXQUOTAS_INIT_BLOCKS() is 219, then 10 credits from ext4_tmpfile()
> itself and then ext4_xattr_credits_for_new_inode() adds more credits
> needed for security attributes and ACLs. Now the
> EXT4_MAXQUOTAS_INIT_BLOCKS() is in fact unnecessary because we've
> already initialized quotas with dquot_init() shortly before and so
> EXT4_MAXQUOTAS_TRANS_BLOCKS() is enough (which boils down to 3 credits).
>
> Fixes: af51a2ac36d1 ("ext4: ->tmpfile() support")
> Signed-off-by: Jan Kara <jack@...e.cz>

Thanks for the fix patch. I have tested the patch on a power machine with smaller
disk and journal size, generic/697 test passed (for both bs<ps and bs=ps) and no
longer seeing the error.

Feel free to add:
Tested-by: Disha Goel<disgoel@...ux.ibm.com>

> ---
>   fs/ext4/namei.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 05b647e6bc19..58fee3c6febc 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2898,7 +2898,7 @@ static int ext4_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
>   	inode = ext4_new_inode_start_handle(idmap, dir, mode,
>   					    NULL, 0, NULL,
>   					    EXT4_HT_DIR,
> -			EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) +
> +			EXT4_MAXQUOTAS_TRANS_BLOCKS(dir->i_sb) +
>   			  4 + EXT4_XATTR_TRANS_BLOCKS);
>   	handle = ext4_journal_current_handle();
>   	err = PTR_ERR(inode);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ