From: Čestmír Kalina <ckalina@xxxxxxxxxx> kabi: introduce RH_KABI_HIDE_INCLUDE and RH_KABI_FAKE_INCLUDE Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2024595 Upstream Status: RHEL only commit 731d6d62fc7f0246d97e9cb5e29f549e40062b5d Author: Jiri Benc <jbenc@xxxxxxxxxx> Date: Wed, 19 Feb 2020 12:04:19 -0500 Introduce a macro for the common pattern of a newly added #include uncovering a previously opaque structure to genksyms or vice versa. Note that the parameter to the new macros is now subject to macro expansion. Unfortunately, there's a 'linux' macro already defined at the system level with a value of '1'. This would lead to any attempt to include linux/something.h to try to include 1/something.h instead. The 'linux' macro is not really needed in the kernel, we know we're building on Linux; however, to accommodate the rare obsolete cases where it is used (drivers/scsi/aic7xxx/aicasm/aicasm.c and include/linux/a.out.h), keep it defined. There is also a genksyms-guarded include in drivers/message/fusion/mptlan.h but that is inherited from upstream and it is kept that way by this patch. RH-Signed-off-by: Jiri Benc <jbenc@xxxxxxxxxx> Signed-off-by: Čestmír Kalina <ckalina@xxxxxxxxxx> Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx> diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h index blahblah..blahblah 100644 --- a/include/linux/rh_kabi.h +++ b/include/linux/rh_kabi.h @@ -82,6 +82,23 @@ * RH_KABI_REPLACE_UNSAFE * Unsafe version of RH_KABI_REPLACE. Only use for typedefs. * + * RH_KABI_HIDE_INCLUDE + * Hides the given include file from kABI checksum computations. This is + * used when a newly added #include makes a previously opaque struct + * visible. + * + * Example usage: + * #include RH_KABI_HIDE_INCLUDE(<linux/poll.h>) + * + * RH_KABI_FAKE_INCLUDE + * Pretends inclusion of the given file for kABI checksum computations. + * This is used when upstream removed a particular #include but that made + * some structures opaque that were previously visible and is causing kABI + * checker failures. + * + * Example usage: + * #include RH_KABI_FAKE_INCLUDE(<linux/rhashtable.h>) + * * RH_KABI_FORCE_CHANGE * Force change of the symbol checksum. The argument of the macro is a * version for cases we need to do this more than once. @@ -122,6 +139,10 @@ * (mainly for RH_KABI_EXTEND, but applied to all macros for uniformity). * */ + +#undef linux +#define linux linux + #ifdef __GENKSYMS__ # define RH_KABI_CONST @@ -129,6 +150,8 @@ # define RH_KABI_FILL_HOLE(_new) # define RH_KABI_FORCE_CHANGE(ver) __attribute__((rh_kabi_change ## ver)) # define RH_KABI_RENAME(_orig, _new) _orig +# define RH_KABI_HIDE_INCLUDE(_file) <linux/rh_kabi.h> +# define RH_KABI_FAKE_INCLUDE(_file) _file # define _RH_KABI_DEPRECATE(_type, _orig) _type _orig # define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...) _type (*_orig)(_args) @@ -145,6 +168,8 @@ # define RH_KABI_FILL_HOLE(_new) _new; # define RH_KABI_FORCE_CHANGE(ver) # define RH_KABI_RENAME(_orig, _new) _new +# define RH_KABI_HIDE_INCLUDE(_file) _file +# define RH_KABI_FAKE_INCLUDE(_file) <linux/rh_kabi.h> #if IS_BUILTIN(CONFIG_RH_KABI_SIZE_ALIGN_CHECKS) -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1530 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure