Bug 1571292 - VDO misuses GFP flags to __vmalloc
Summary: VDO misuses GFP flags to __vmalloc
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kmod-kvdo
Version: 7.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Thomas Jaskiewicz
QA Contact: Jakub Krysl
Depends On:
TreeView+ depends on / blocked
Reported: 2018-04-24 13:08 UTC by Sweet Tea Dorminy
Modified: 2018-10-30 09:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-10-30 09:39:31 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3094 0 None None None 2018-10-30 09:40:09 UTC

Description Sweet Tea Dorminy 2018-04-24 13:08:50 UTC
Description of problem:
VDO has a central allocation function, allocateMemory(). It attempts to use kmalloc or __vmalloc to satisfy allocations. This should probably be kvmalloc, as is the standard kernel practice. Moreover, it passes the same flags to __vmalloc as to kmalloc, including GFP_NOIO when IO is unsafe to do to satisfy the allocation, and __GFP_REPEAT/__GFP_RETRY_MAYFAIL. 

As per [1], using __vmalloc in a situation where IO is unsafe at all is unsafe, even if GFP_NOIO is pased to __vmalloc, because it may do a kmalloc without GFP_NOIO. This could lead to a deadlock in certain lowmem situations. Furthermore, as per [2], the use of retry modifiers (i.e. __GFP_RETRY_MAYFAIL) as parameters to __vmalloc is not supported.

[1] http://lkml.iu.edu/hypermail/linux/kernel/1706.3/04681.html
[2] https://elixir.bootlin.com/linux/latest/source/mm/vmalloc.c#L1780

Version-Release number of selected component (if applicable):

Actual results:
Extremely rare (theoretical) deadlock under low memory conditions.

Expected results:
No deadlock even under low memory conditions.

Additional info:
Probably SanityOnly.

Comment 2 Thomas Jaskiewicz 2018-07-17 19:00:54 UTC
We will stop using the __GFP_NORETRY flag.

We will stop using GFP_NOIO, and instead use the memalloc_noio_save and memalloc_noio_restore methods, which have been backported to RHEL7.5

Comment 3 Thomas Jaskiewicz 2018-07-18 00:59:30 UTC
Fixed in version

Comment 5 Jakub Krysl 2018-08-30 14:59:20 UTC
As reproducing this is extremely hard (one has to dump traces of all threads and look for deadlocking conditions on the same memory ranges), sanity only testing was performed.
This passed on kmod-kvdo-

Comment 7 errata-xmlrpc 2018-10-30 09:39: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, and where to find the updated
files, follow the link below.

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


Note You need to log in before you can comment on or make changes to this bug.