Advertisement
Guest User

Nvidia 340xx Patch

a guest
Oct 8th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. Author: Andreas Beckmann <anbe@debian.org>
  2. Description: use kmem_cache_create_usercopy on 4.16+
  3. fixes "Bad or missing usercopy whitelist? Kernel memory exposure attempt
  4. detected from SLUB object 'nvidia_stack_cache'" on linux-image-4.16.0-2-*
  5. or newer that have disabled CONFIG_HARDENED_USERCOPY_FALLBACK
  6. Bug-Debian: #901919, #899998
  7. Bug: https://devtalk.nvidia.com/default/topic/1031067
  8.  
  9. --- kernel/nv-linux.h
  10. +++ kernel/nv-linux.h
  11. @@ -757,11 +757,18 @@ extern nv_spinlock_t km_lock;
  12. 0, 0, NULL, NULL); \
  13. }
  14. #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
  15. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
  16. +#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
  17. + { \
  18. + kmem_cache = kmem_cache_create_usercopy(name, sizeof(type), 0, 0, 0, sizeof(type), NULL); \
  19. + }
  20. +#else
  21. #define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
  22. { \
  23. kmem_cache = kmem_cache_create(name, sizeof(type), \
  24. 0, 0, NULL); \
  25. }
  26. +#endif
  27. #else
  28. #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!"
  29. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement