drm/ttm: use designated initializers
Subsystems (4)
PATCH 1/1 drm/ttm: use designated initializers
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity.
--- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/virtio/virtgpu_ttm.c +5 -5
@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
Signature · 6 lines
2.7.4 -- Kees Cook Nexus Security
Quoted 11 lines · Alexander Stein
Hello Kees,
While understanding what your patches (I've seen the other ones as well) do themself, I still don't get what your intention is, e.g. why you need this? Apart from a better readability.
Quoted 2 lines · Kees Cook
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers.
Can you please elaborate what you mean with that sentence?
Hi! Sure: the coming (and optional) gcc plugin "randstruct" performs structure layout randomization, which means that static initializers cannot be "ordered" (they must be "designated"), since the place were layout randomization occurs happens separate from how static initializers are applied.
This change from ordered to designated is just to help the compiler do the right thing.
-Kees
Signature · 2 lines
Kees Cook Nexus Security