Bug 1884689

Summary: libblockdev exec routines lead to deadlock or infinite loop
Product: Red Hat Enterprise Linux 8 Reporter: Tomáš Bžatek <tbzatek>
Component: libblockdevAssignee: Vojtech Trefny <vtrefny>
Status: CLOSED ERRATA QA Contact: guazhang <guazhang>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: guazhang, vtrefny
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libblockdev-2.24-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:42:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomáš Bžatek 2020-10-02 16:44:40 UTC
Several deficiencies in the libblockdev utils/exec code were found upstream, potentially leading to deadlock or an infinite loop. Tests demonstrating the issues are available.

Fixed upstream: https://github.com/storaged-project/libblockdev/pull/572


Steps to reproduce:
 1. create and activate 400 or more LVM snapshots
 2. start udisksd, observe infinite loop

Since UDisks and possibly other tools use this libblockdev functionality, it's only a matter of time until this issue demonstrates on the client side.

Comment 3 guazhang@redhat.com 2020-11-23 07:44:22 UTC
Hi,

I can not reproduce the bug with libblockdev-2.24-2.el8, Could you please provides more details.


test steps:


pvcreate  /dev/sdb
vgcreate   myvol  /dev/sdb
lvcreate -L 200G  -n  date  myvol
mkfs.xfs /dev/myvol/date
mkdir -p test
mount   /dev/myvol/date test
for i in {1..400};do
    touch test/txt$i
    lvcreate  -L 10M  -p  r  -s  -n  datesnap$i  /dev/myvol/date
done
systemctl restart udisks2

Comment 4 Vojtech Trefny 2020-11-23 12:50:38 UTC
UDisks should still work but you should see stuck lvm processes and UDisks threads waiting for output on the system. I'm changing the needinfo to Tomáš, he might provide a more detailed reproducer.

Btw. we also added a good regression test for this bug, so it might be enough to check that "test_exec_buffer_bloat" passed in the gating.

Comment 5 Tomáš Bžatek 2020-11-26 16:53:29 UTC
You need to have the `lvm2` module activated in UDisks. Use
> gdbus call -y -d org.freedesktop.UDisks2 -o /org/freedesktop/UDisks2/Manager -m org.freedesktop.UDisks2.Manager.EnableModule -- lvm2 true

to enable it.

Then you can use either your reproducer or find inspiration in my loadtests: https://github.com/storaged-project/udisks/pull/814

Please note the issue is not lvm2-specific and certain tools may trigger that as well (we've had reports about dumpe2fs calls AFAIR).

Comment 6 guazhang@redhat.com 2020-11-30 01:41:45 UTC
Thanks for the guide.

Don't hit the bug with fixed package, move to verified.

Comment 8 errata-xmlrpc 2021-05-18 15:42:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (libblockdev bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1820