Re: [OS-BUILD PATCHv4 0/3] redhat: introduce RH_KABI_EXCLUDE_WITH_SIZE and enable size checks

2023-11-17 Thread Justin M. Forbes (via Email Bridge)
From: Justin M. Forbes on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619#note_1654178039

Appreciate the updates. As it no longer has Fedora files, my ack is no longer
required, but it looks good to me.
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: [OS-BUILD PATCHv4 0/3] redhat: introduce RH_KABI_EXCLUDE_WITH_SIZE and enable size checks

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619#note_1654073315

thanks, I removed it now.
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: [OS-BUILD PATCHv4 0/3] redhat: introduce RH_KABI_EXCLUDE_WITH_SIZE and enable size checks

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619#note_1654073206

also removed.
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCHv4 3/3] redhat: kABI: add missing RH_KABI_SIZE_ALIGN_CHECKS Kconfig option

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca 

redhat: kABI: add missing RH_KABI_SIZE_ALIGN_CHECKS Kconfig option

When the kABI macros were copied from the RHEL kernel to ARK, the
RH_KABI_SIZE_ALIGN_CHECKS config option was dropped. Without it, the
size checks included in some of the kABI macros can't be enabled.

Add the KABI_SIZE_ALIGN_CHECKS config option, enable it on RHEL
configs, and disable it for debug, rt, and zfcpdump kernels.

Signed-off-by: Sabrina Dubroca 

diff --git a/Kconfig.redhat b/Kconfig.redhat
index blahblah..blahblah 100644
--- a/Kconfig.redhat
+++ b/Kconfig.redhat
@@ -14,4 +14,13 @@ config RHEL_DIFFERENCES
 
  Unless you want a restricted kernel, say N here.
 
+config RH_KABI_SIZE_ALIGN_CHECKS
+   bool "Enables more stringent kabi checks in the macros"
+   depends on RHEL_DIFFERENCES
+   default y
+   help
+ This option enables more stringent kabi checks. Those must
+ be disabled in case of a debug build, because debug builds
+ allow to change struct sizes.
+
 endmenu
diff --git a/redhat/configs/rhel/debug/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS 
b/redhat/configs/rhel/debug/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/rhel/debug/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
@@ -0,0 +1 @@
+# CONFIG_RH_KABI_SIZE_ALIGN_CHECKS is not set
diff --git a/redhat/configs/rhel/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS 
b/redhat/configs/rhel/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/rhel/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
@@ -0,0 +1 @@
+CONFIG_RH_KABI_SIZE_ALIGN_CHECKS=y
diff --git 
a/redhat/configs/rhel/generic/s390x/zfcpdump/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS 
b/redhat/configs/rhel/generic/s390x/zfcpdump/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ 
b/redhat/configs/rhel/generic/s390x/zfcpdump/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
@@ -0,0 +1 @@
+# CONFIG_RH_KABI_SIZE_ALIGN_CHECKS is not set
diff --git a/redhat/configs/rhel/rt/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS 
b/redhat/configs/rhel/rt/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/rhel/rt/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS
@@ -0,0 +1 @@
+# CONFIG_RH_KABI_SIZE_ALIGN_CHECKS is not set

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCHv4 2/3] redhat: rh_kabi: introduce RH_KABI_EXCLUDE_WITH_SIZE

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca 

redhat: rh_kabi: introduce RH_KABI_EXCLUDE_WITH_SIZE

This macro is similar to RH_KABI_EXTEND_WITH_SIZE, but with a
different intention.  While RH_KABI_EXTEND_WITH_SIZE is meant to add
new elements that may grow in the future to kABI-protected structures,
RH_KABI_EXCLUDE_WITH_SIZE should be used to hide existing elements
from kABI checksum computation, while allowing them to be extended in
the future without silently breaking binary compatibility of any field
that follows it.

The implementation differs from RH_KABI_EXTEND_WITH_SIZE so that _size
is included in the kABI checksum. That way, we can't accidentally grow
the reserved space, as that would change the offsets of all the
following fields.

The size check guarantees that binary compatibility is preserved.
Until now, __RH_KABI_CHECK_SIZE was only used in the !__GENKSYMS__
versions of macros, so it wasn't defined in the __GENKSYMS__
case. We need to define it to nothing so that _new is ignored by
checksum computation.

Signed-off-by: Sabrina Dubroca 

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
@@ -306,6 +306,23 @@
  *   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.
  *
+ * RH_KABI_EXCLUDE_WITH_SIZE
+ *   Like RH_KABI_EXCLUDE, this macro excludes the element from
+ *   checksum generation.  The same warnings as for RH_KABI_EXCLUDE
+ *   apply: use RH_KABI_FORCE_CHANGE.
+ *
+ *   This macro is intended to be used for elements embedded inside
+ *   kABI-protected structures (struct, array). In contrast with
+ *   RH_KABI_EXCLUDE, this macro reserves extra space, so that the
+ *   embedded element can grow without changing the offsets of the
+ *   fields that follow. The provided 'size' is the total space to be
+ *   added in longs (i.e. it's 8 * 'size' bytes), including the size
+ *   of the added element.  It is automatically checked that the new
+ *   element does not overflow the reserved space, now nor in the
+ *   future. The size is also included in the checksum via the
+ *   reserved space, to ensure that we don't accidentally change it,
+ *   which would change the offsets of the fields that follow.
+ *
  * RH_KABI_BROKEN_INSERT
  * RH_KABI_BROKEN_REMOVE
  *   Insert a field to the middle of a struct / delete a field from a struct.
@@ -377,6 +394,8 @@
 # define _RH_KABI_REPLACE(_orig, _new) _orig
 # define _RH_KABI_EXCLUDE(_elem)
 
+# define __RH_KABI_CHECK_SIZE(_item, _size)
+
 #else
 
 # define RH_KABI_ALIGN_WARNING ".  Disable CONFIG_RH_KABI_SIZE_ALIGN_CHECKS if 
debugging."
@@ -477,6 +496,13 @@
 
 #define RH_KABI_EXCLUDE(_elem) _RH_KABI_EXCLUDE(_elem);
 
+#define RH_KABI_EXCLUDE_WITH_SIZE(_new, _size) \
+   union { \
+   RH_KABI_EXCLUDE(_new)   \
+   unsigned long RH_KABI_UNIQUE_ID[_size]; \
+   __RH_KABI_CHECK_SIZE(_new, 8 * (_size)) \
+   };
+
 #define RH_KABI_EXTEND_WITH_SIZE(_new, _size)  \
RH_KABI_EXTEND(union {  \
_new;   \

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCHv4 1/3] redhat: rh_kabi: move semicolon inside __RH_KABI_CHECK_SIZE

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca 

redhat: rh_kabi: move semicolon inside __RH_KABI_CHECK_SIZE

With the current implementation, an unnecessary semicolon is left
during the GENKSYMS pass (which doesn't matter since at the moment
__RH_KABI_CHECK_SIZE is only used during the !GENKSYMS pass -- it's
burried inside RH_KABI_EXTEND). This wouldn't cause any issue, but
could be confusing to other developers once we start using
__RH_KABI_CHECK_SIZE during the GENKSYMS pass.

Suggested-by: Jiri Benc 
Signed-off-by: Sabrina Dubroca 

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
@@ -408,7 +408,7 @@
}
 # define __RH_KABI_CHECK_SIZE(_item, _size)\
_Static_assert(sizeof(struct{_item;}) <= _size, \
-  __FILE__ ":" __stringify(__LINE__) ": " 
__stringify(_item) " is larger than the reserved size (" __stringify(_size) " 
bytes)" RH_KABI_ALIGN_WARNING)
+  __FILE__ ":" __stringify(__LINE__) ": " 
__stringify(_item) " is larger than the reserved size (" __stringify(_size) " 
bytes)" RH_KABI_ALIGN_WARNING);
 #else
 # define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new)
 # define __RH_KABI_CHECK_SIZE(_item, _size)
@@ -481,7 +481,7 @@
RH_KABI_EXTEND(union {  \
_new;   \
unsigned long RH_KABI_UNIQUE_ID[_size]; \
-   __RH_KABI_CHECK_SIZE(_new, 8 * (_size));\
+   __RH_KABI_CHECK_SIZE(_new, 8 * (_size)) \
})
 
 #define _RH_KABI_AUX_PTR(_struct)  \

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCHv4 0/3] redhat: introduce RH_KABI_EXCLUDE_WITH_SIZE and enable size checks

2023-11-17 Thread Sabrina Dubroca (via Email Bridge)
From: Sabrina Dubroca on gitlab.com
Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1619

This MR introduces a new kABI macro, RH_KABI_EXCLUDE_WITH_SIZE. The
implementation is identical to RH_KABI_EXTEND_WITH_SIZE, but the meaning is
more in line with RH_KABI_EXCLUDE. The size check and reserved space allows us
to exclude an element embedded inside a kABI-protected structure while
reserving space for it to grow in the future.

The size checks that are part of multiple kABI macros are currently not
enabled because the config option to turn them on is missing. Those size
checks only make sense on regular builds, so they're disabled on debug
kernels.

Signed-off-by: Sabrina Dubroca 

---
 include/linux/rh_kabi.h |  
30 +-
 redhat/configs/rhel/debug/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS  |  
 1 +
 redhat/configs/rhel/generic/s390x/zfcpdump/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS |  
 1 +
 redhat/configs/rhel/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS|  
 1 +
 redhat/configs/rhel/rt/generic/CONFIG_RH_KABI_SIZE_ALIGN_CHECKS |  
 1 +
 Kconfig.redhat  |  
 9 +++
 6 files changed, 41 insertions(+), 2 deletions(-)
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue