diff options
| author | Lucas De Marchi <[email protected]> | 2024-08-16 10:05:54 -0700 |
|---|---|---|
| committer | Lucas De Marchi <[email protected]> | 2024-08-16 10:33:54 -0700 |
| commit | ed7171ff9fabc49ae6ed42fbd082a576473836fc (patch) | |
| tree | 62bc21b9b590a7fefb27b6103a121f4386e1815f /include/linux/randomize_kstack.h | |
| parent | db3461a7743817ad7c73553902231b096616813a (diff) | |
| parent | a809b92ee0f84c3f655b16a8b4d04bc3665d954a (diff) | |
Merge drm/drm-next into drm-xe-next
Get drm-xe-next on v6.11-rc2 and synchronized with drm-intel-next for
the display side. This resolves the current conflict for the
enable_display module parameter and allows further pending refactors.
Signed-off-by: Lucas De Marchi <[email protected]>
Diffstat (limited to 'include/linux/randomize_kstack.h')
| -rw-r--r-- | include/linux/randomize_kstack.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/randomize_kstack.h b/include/linux/randomize_kstack.h index 6d92b68efbf6..1d982dbdd0d0 100644 --- a/include/linux/randomize_kstack.h +++ b/include/linux/randomize_kstack.h @@ -32,13 +32,19 @@ DECLARE_PER_CPU(u32, kstack_offset); #endif /* - * Use, at most, 10 bits of entropy. We explicitly cap this to keep the - * "VLA" from being unbounded (see above). 10 bits leaves enough room for - * per-arch offset masks to reduce entropy (by removing higher bits, since - * high entropy may overly constrain usable stack space), and for - * compiler/arch-specific stack alignment to remove the lower bits. + * Use, at most, 6 bits of entropy (on 64-bit; 8 on 32-bit). This cap is + * to keep the "VLA" from being unbounded (see above). Additionally clear + * the bottom 4 bits (on 64-bit systems, 2 for 32-bit), since stack + * alignment will always be at least word size. This makes the compiler + * code gen better when it is applying the actual per-arch alignment to + * the final offset. The resulting randomness is reasonable without overly + * constraining usable stack space. */ -#define KSTACK_OFFSET_MAX(x) ((x) & 0x3FF) +#ifdef CONFIG_64BIT +#define KSTACK_OFFSET_MAX(x) ((x) & 0b1111110000) +#else +#define KSTACK_OFFSET_MAX(x) ((x) & 0b1111111100) +#endif /** * add_random_kstack_offset - Increase stack utilization by previously |