feature-control.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* x86-64 feature tuning.
  2. This file is part of the GNU C Library.
  3. Copyright (C) 2018-2026 Free Software Foundation, Inc.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _X86_64_FEATURE_CONTROL_H
  16. #define _X86_64_FEATURE_CONTROL_H
  17. /* For each CET feature, IBT and SHSTK, valid control values. */
  18. enum dl_x86_cet_control
  19. {
  20. /* Enable CET features based on ELF property note. */
  21. cet_elf_property = 0,
  22. /* Always enable CET features. */
  23. cet_always_on,
  24. /* Always disable CET features. */
  25. cet_always_off,
  26. /* Enable CET features permissively. */
  27. cet_permissive
  28. };
  29. /* PLT rewrite control. */
  30. enum dl_plt_rewrite_control
  31. {
  32. /* No PLT rewrite. */
  33. plt_rewrite_none,
  34. /* Rewrite PLT with JMP at run-time. */
  35. plt_rewrite_jmp,
  36. /* Rewrite PLT with JMP and JMPABS at run-time. */
  37. plt_rewrite_jmpabs
  38. };
  39. struct dl_x86_feature_control
  40. {
  41. enum dl_x86_cet_control ibt : 2;
  42. enum dl_x86_cet_control shstk : 2;
  43. enum dl_plt_rewrite_control plt_rewrite : 2;
  44. };
  45. #endif /* feature-control.h */