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-next>] [day] [month] [year] [list]
Message-ID: <CAHLe9YZvOcbimNsaYa=jk27uUR1jgVDtXXztLEa0AVnqveOoyQ@mail.gmail.com>
Date:   Tue, 23 Aug 2022 12:16:46 +0800
From:   Boyang Xue <bxue@...hat.com>
To:     linux-ext4@...r.kernel.org
Cc:     linux-fsdevel@...r.kernel.org, Lukas Czerner <lczerner@...hat.com>
Subject: [bug report] disk quota exceed after multiple write/delete loops

On the latest kernel 6.0.0-0.rc2, I find the user quota limit in an
ext4 mount is unstable, that after several successful "write file then
delete" loops, it will finally fail with "Disk quota exceeded". This
bug can be reproduced on at least kernel-6.0.0-0.rc2 and
kernel-5.14.0-*, but can't be reproduced on kernel-4.18.0 based RHEL8
kernel.

Reproducer (can also be found as the attachment):
```
#!/bin/bash

# setup
groupadd -f quota_test
useradd -g quota_test quota_test_user1
dd if=/dev/null of=ext4_5G.img bs=1G seek=5
lo_dev=$(losetup -f --show ext4_5G.img)
mkdir /mntpt
mkfs.ext4 -F ext4_5G.img
mount -o usrquota ext4_5G.img /mntpt
chmod 777 /mntpt
quotacheck -u /mntpt
setquota -u quota_test_user1 200000 300000 2000 3000 /mntpt
quotaon -u /mntpt

# test
for i in $(seq 1 100); do
    echo "*** Run#$((i++)) ***"
    echo "--- Quota before writing file ---"; quota -uv
quota_test_user1; echo "--- ---"
    su - quota_test_user1 -c "dd if=/dev/zero of=/mntpt/test_300m
bs=1024 count=300000" || break_flag=1
    echo "--- Quota after writing file ---"; quota -uv
quota_test_user1; echo "--- ---"
    rm -f /mntpt/test_300m
    sleep 10s # in case slow deletion
    echo "--- Quota after deleting file ---"; quota -uv
quota_test_user1; echo "--- ---"
    [[ $break_flag -eq 1 ]] && break
done

# cleanup
umount /mntpt
losetup -D
rm -rf ext4_5G.img /mntpt
userdel -r quota_test_user1
groupdel quota_test
```

Run log on kernel-6.0.0-0.rc2
```
(...skip successful Run#[1-2]...)
*** Run#3 ***
--- Quota before writing file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0       0  200000  300000               0    2000    3000
--- ---
dd: error writing '/mntpt/test_300m': Disk quota exceeded
299997+0 records in
299996+0 records out
307195904 bytes (307 MB, 293 MiB) copied, 1.44836 s, 212 MB/s
--- Quota after writing file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0  300000* 200000  300000   7days       1    2000    3000
--- ---
--- Quota after deleting file ---
Disk quotas for user quota_test_user1 (uid 1003):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/loop0       0  200000  300000               0    2000    3000
--- ---
```

The kernel in test can be found at
https://koji.fedoraproject.org/koji/buildinfo?buildID=2050107

Download attachment "test_quota_v01.sh" of type "application/x-sh" (994 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ