From: Čestmír Kalina <ckalina@xxxxxxxxxx> kabi: change RH_KABI_REPLACE_UNSAFE to RH_KABI_BROKEN_REPLACE Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2024595 Upstream Status: RHEL only commit f34b146a5403ff8ad8d7308e59331d38d29cb373 Author: Jiri Benc <jbenc@xxxxxxxxxx> Date: Wed, 1 Apr 2020 13:04:04 -0400 The macro RH_KABI_REPLACE_UNSAFE (and especially its comment) is misleading to developers trying to use it. The macro was needed in the past when RH_KABI_REPLACE was not smart enough and did not allow old and new struct field to have the same name (i.e. type change). This is not the case anymore. Another use of RH_KABI_REPLACE was typedefs but we have a better mechanism to deal with that now. The only remaining usage of RH_KABI_REPLACE_UNSAFE is in places where we actually want to break the binary representation of the struct. We have RH_KABI_BROKEN_ family of macros for that; rework RH_KABI_REPLACE_UNSAFE to RH_KABI_BROKEN_REPLACE. 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 @@ -95,9 +95,6 @@ * union structure preserves the size alignment (assuming the '_new' element * is not bigger than the '_orig' element). * - * 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 @@ -172,6 +169,10 @@ * by ';' inside(!) the macro parameter. The macro itself must not be * terminated by ';'. * + * RH_KABI_BROKEN_REPLACE + * Replace a field by a different one without doing any checking. This + * allows replacing a field by another with a different size. Similarly + * to other RH_KABI_BROKEN macros, use of this indicates a kABI breakage. */ #undef linux @@ -191,11 +192,11 @@ # define RH_KABI_BROKEN_REMOVE(_orig) _orig; # define RH_KABI_BROKEN_INSERT_BLOCK(_new) # define RH_KABI_BROKEN_REMOVE_BLOCK(_orig) _orig +# define RH_KABI_BROKEN_REPLACE(_orig, _new) _orig; # define _RH_KABI_DEPRECATE(_type, _orig) _type _orig # define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...) _type (*_orig)(_args) # define _RH_KABI_REPLACE(_orig, _new) _orig -# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _orig # define _RH_KABI_EXCLUDE(_elem) #else @@ -214,6 +215,7 @@ # define RH_KABI_BROKEN_REMOVE(_orig) # define RH_KABI_BROKEN_INSERT_BLOCK(_new) _new # define RH_KABI_BROKEN_REMOVE_BLOCK(_orig) +# define RH_KABI_BROKEN_REPLACE(_orig, _new) _new; #if IS_BUILTIN(CONFIG_RH_KABI_SIZE_ALIGN_CHECKS) @@ -245,7 +247,6 @@ } RH_KABI_UNIQUE_ID; \ __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new); \ } -# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _new # define _RH_KABI_EXCLUDE(_elem) _elem @@ -256,7 +257,6 @@ # define RH_KABI_DEPRECATE_FN(_type, _orig, _args...) \ _RH_KABI_DEPRECATE_FN(_type, _orig, _args); # define RH_KABI_REPLACE(_orig, _new) _RH_KABI_REPLACE(_orig, _new); -# define RH_KABI_REPLACE_UNSAFE(_orig, _new) _RH_KABI_REPLACE_UNSAFE(_orig, _new); /* * Macro for breaking up a random element into two smaller chunks using an * anonymous struct inside an anonymous union. -- 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