errata.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Landlock - Errata information
  4. *
  5. * Copyright © 2025 Microsoft Corporation
  6. */
  7. #ifndef _SECURITY_LANDLOCK_ERRATA_H
  8. #define _SECURITY_LANDLOCK_ERRATA_H
  9. #include <linux/init.h>
  10. struct landlock_erratum {
  11. const int abi;
  12. const u8 number;
  13. };
  14. /* clang-format off */
  15. #define LANDLOCK_ERRATUM(NUMBER) \
  16. { \
  17. .abi = LANDLOCK_ERRATA_ABI, \
  18. .number = NUMBER, \
  19. },
  20. /* clang-format on */
  21. /*
  22. * Some fixes may require user space to check if they are applied on the running
  23. * kernel before using a specific feature. For instance, this applies when a
  24. * restriction was previously too restrictive and is now getting relaxed (for
  25. * compatibility or semantic reasons). However, non-visible changes for
  26. * legitimate use (e.g. security fixes) do not require an erratum.
  27. */
  28. static const struct landlock_erratum landlock_errata_init[] __initconst = {
  29. /*
  30. * Only Sparse may not implement __has_include. If a compiler does not
  31. * implement __has_include, a warning will be printed at boot time (see
  32. * setup.c).
  33. */
  34. #ifdef __has_include
  35. #define LANDLOCK_ERRATA_ABI 1
  36. #if __has_include("errata/abi-1.h")
  37. #include "errata/abi-1.h"
  38. #endif
  39. #undef LANDLOCK_ERRATA_ABI
  40. #define LANDLOCK_ERRATA_ABI 2
  41. #if __has_include("errata/abi-2.h")
  42. #include "errata/abi-2.h"
  43. #endif
  44. #undef LANDLOCK_ERRATA_ABI
  45. #define LANDLOCK_ERRATA_ABI 3
  46. #if __has_include("errata/abi-3.h")
  47. #include "errata/abi-3.h"
  48. #endif
  49. #undef LANDLOCK_ERRATA_ABI
  50. #define LANDLOCK_ERRATA_ABI 4
  51. #if __has_include("errata/abi-4.h")
  52. #include "errata/abi-4.h"
  53. #endif
  54. #undef LANDLOCK_ERRATA_ABI
  55. #define LANDLOCK_ERRATA_ABI 5
  56. #if __has_include("errata/abi-5.h")
  57. #include "errata/abi-5.h"
  58. #endif
  59. #undef LANDLOCK_ERRATA_ABI
  60. #define LANDLOCK_ERRATA_ABI 6
  61. #if __has_include("errata/abi-6.h")
  62. #include "errata/abi-6.h"
  63. #endif
  64. #undef LANDLOCK_ERRATA_ABI
  65. /*
  66. * For each new erratum, we need to include all the ABI files up to the impacted
  67. * ABI to make all potential future intermediate errata easy to backport.
  68. *
  69. * If such change involves more than one ABI addition, then it must be in a
  70. * dedicated commit with the same Fixes tag as used for the actual fix.
  71. *
  72. * Each commit creating a new security/landlock/errata/abi-*.h file must have a
  73. * Depends-on tag to reference the commit that previously added the line to
  74. * include this new file, except if the original Fixes tag is enough.
  75. *
  76. * Each erratum must be documented in its related ABI file, and a dedicated
  77. * commit must update Documentation/userspace-api/landlock.rst to include this
  78. * erratum. This commit will not be backported.
  79. */
  80. #endif
  81. {}
  82. };
  83. #endif /* _SECURITY_LANDLOCK_ERRATA_H */