diff options
author | Juergen Gross <jgross@suse.com> | 2019-11-07 12:15:45 +0100 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2019-12-02 07:39:18 +0100 |
commit | 3b06ac6707c196b5036fe013c460da86c9060085 (patch) | |
tree | d6f3af7ef5da97dd674cb2461e30db2297457fbc /fs/io-wq.h | |
parent | d41b26d81a83e04500e926fbab746ae87c20bb0e (diff) | |
download | linux-stable-3b06ac6707c196b5036fe013c460da86c9060085.tar.gz linux-stable-3b06ac6707c196b5036fe013c460da86c9060085.tar.bz2 linux-stable-3b06ac6707c196b5036fe013c460da86c9060085.zip |
xen/gntdev: replace global limit of mapped pages by limit per call
Today there is a global limit of pages mapped via /dev/xen/gntdev set
to 1 million pages per default. There is no reason why that limit is
existing, as total number of grant mappings is limited by the
hypervisor anyway and preferring kernel mappings over userspace ones
doesn't make sense. It should be noted that the gntdev device is
usable by root only.
Additionally checking of that limit is fragile, as the number of pages
to map via one call is specified in a 32-bit unsigned variable which
isn't tested to stay within reasonable limits (the only test is the
value to be <= zero, which basically excludes only calls without any
mapping requested). So trying to map e.g. 0xffff0000 pages while
already nearly 1000000 pages are mapped will effectively lower the
global number of mapped pages such that a parallel call mapping a
reasonable amount of pages can succeed in spite of the global limit
being violated.
So drop the global limit and introduce per call limit instead. This
per call limit (default: 65536 grant mappings) protects against
allocating insane large arrays in the kernel for doing a hypercall
which will fail anyway in case a user is e.g. trying to map billions
of pages.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'fs/io-wq.h')
0 files changed, 0 insertions, 0 deletions