kernel/0001-rh_kabi-introduce-RH_KABI_EXCLUDE.patch
Justin M. Forbes 9f7f1a167a kernel-5.9.0-0.rc4.20200909git34d4ddd359db.5
* Wed Sep 09 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.9.0-0.rc4.20200909git34d4ddd359db.5]
- Merge ark-patches
Resolves: rhbz#

Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-09-09 12:27:11 -05:00

105 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jakub Racek <jracek@redhat.com>
Date: Thu, 22 Nov 2018 12:59:45 +0100
Subject: [PATCH] rh_kabi: introduce RH_KABI_EXCLUDE
Message-id: <1542891606-8048-24-git-send-email-jracek@redhat.com>
Patchwork-id: 233503
O-Subject: [ARK PATCH 23/44] [kernel] rh_kabi: introduce RH_KABI_EXCLUDE
Bugzilla: 1652256
RH-Acked-by: Don Zickus <dzickus@redhat.com>
RH-Acked-by: Jiri Benc <jbenc@redhat.com>
From: Jiri Benc <jbenc@redhat.com>
Bugzilla: 1652256
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19244562
rhel8 commit 1c588b1bbe6ea3e9e1701ccf10e22f73f687ad02
Author: Jiri Benc <jbenc@redhat.com>
Date: Wed Nov 21 17:15:39 2018 +0100
[kernel] rh_kabi: introduce RH_KABI_EXCLUDE
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1568551
Add a way to exclude certain fields of a structure that would be otherwise
kABI whitelisted. The new RH_KABI_EXCLUDE macro serves two purposes:
1. Not adding the excluded fields to symbol checksums, making their later
changes easier.
2. Document that the given fields are not considered to be kABI whitelisted
by Red Hat.
Note that:
- This needs to be done _before_ the actual structure gets whitelisted.
- It still allows later conversion of the excluded fields to whitelist
covered fields by simply changing RH_KABI_EXCLUDE to RH_KABI_EXTEND.
- The excluded fields can be modified at will but extra care needs to be
taken to not cause problems with 3rd party drivers using the fields. See
the comment inside the patch for details.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Upstream Status: RHEL only
Signed-off-by: Jakub Racek <jracek@redhat.com>
---
include/linux/rh_kabi.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h
index e0d3353802bb..87f2bd530df7 100644
--- a/include/linux/rh_kabi.h
+++ b/include/linux/rh_kabi.h
@@ -80,6 +80,18 @@
* corrupt memory. Instead, by changing the symbol checksum, such modules
* won't be loaded by the kernel. This macro should only be used as a
* last resort when all other KABI workarounds have failed.
+ * RH_KABI_EXCLUDE
+ * Exclude the element from checksum generation. Any such element is
+ * considered not to be part of the kABI whitelist and may be changed at
+ * will. Note however that it's the responsibility of the developer
+ * changing the element to ensure 3rd party drivers using this element
+ * won't panic, for example by not allowing them to be loaded. That can
+ * be achieved by changing another, non-whitelisted symbol they use,
+ * either by nature of the change or by using RH_KABI_FORCE_CHANGE.
+ *
+ * Also note that any change to the element must preserve its size. Change
+ * of the size is not allowed and would constitute a silent kABI breakage.
+ * Beware that the RH_KABI_EXCLUDE macro does not do any size checks.
*
* NOTE
* Don't use ';' after these macros as it messes up the kABI checker by
@@ -100,6 +112,7 @@
# 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
@@ -137,6 +150,8 @@
}
# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _new
+# define _RH_KABI_EXCLUDE(_elem) _elem
+
#endif /* __GENKSYMS__ */
/* semicolon added wrappers for the RH_KABI_REPLACE macros */
@@ -169,4 +184,6 @@
*/
# define _RH_KABI_RESERVE(n) unsigned long rh_reserved##n
+#define RH_KABI_EXCLUDE(_elem) _RH_KABI_EXCLUDE(_elem);
+
#endif /* _LINUX_RH_KABI_H */
--
2.28.0