Skip to content
This repository was archived by the owner on Aug 18, 2022. It is now read-only.

Commit b97636a

Browse files
mstoecklemersion
authored andcommitted
Add client which uses up finite compositor resources
This makes it possible to check how compositors behave when resource limits are reached. The three initial modes check what happens when file descriptors, memory map areas, and allocated memory are exhausted. Memory map exhaustion is implemented by making and retaining many wl_shm_pool objects, each of which leads to the compositor making an mmap call. Allocated memory exhaustion is implemented by progressively building up wl_region objects; the client only sends random and disjoint wl_region.add messages, but the compositor must remember them all. File descriptor exhaustion is achieved by creating many buffers based on the same dmabuf. Compositors do not deduplicate the file descriptors sent to create the buffers. In all cases, the resource thief client pays much less than the compositor, because it reuses an object that the compositor has no reason to deduplicate, or creates a complicated remote object without storing a local copy.
1 parent 572385d commit b97636a

File tree

4 files changed

+373
-1
lines changed

4 files changed

+373
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ninja -C build
1515
* `frame-callback`: requests frame callbacks indefinitely
1616
* `resize-loop`: resizes itself indefinitely
1717
* `resizor`: uses buffer position to initiate a client-side resize
18+
* `resource-thief`: makes the compositor run out of (fd or memory) resources
1819
* `sigbus`: trigger SIGBUS in the compositor by shrinking a shm file
1920
* `slow-ack-configure`: responds to configure events very slowly
2021
* `subsurfaces`: displays a bunch of subsurfaces and lets you reorder them

meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(
33
'c',
44
version: '0.0.0',
55
license: 'MIT',
6-
meson_version: '>=0.47.0',
6+
meson_version: '>=0.49.0',
77
default_options: [
88
'c_std=c11',
99
'warning_level=2',
@@ -23,6 +23,7 @@ wayland_client = dependency('wayland-client')
2323
wayland_server = dependency('wayland-server')
2424
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
2525
math = cc.find_library('m', required: false)
26+
gbm = dependency('gbm', disabler: true)
2627

2728
subdir('protocol')
2829

@@ -67,6 +68,10 @@ clients = {
6768
'resizor': {
6869
'src': 'resizor.c',
6970
},
71+
'resource-thief': {
72+
'src': 'resource-thief.c',
73+
'deps': [gbm],
74+
},
7075
'sigbus': {
7176
'src': 'sigbus.c',
7277
},

protocol/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ endif
1212
client_protocols = [
1313
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
1414
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'],
15+
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
1516
]
1617

1718
client_protos_src = []

0 commit comments

Comments
 (0)