s390/kpatch-build: Restrict -mno-pic-data-is-text-relative flag#1492
s390/kpatch-build: Restrict -mno-pic-data-is-text-relative flag#1492sumanthkorikkar wants to merge 1 commit intodynup:masterfrom
Conversation
kpatch-build/kpatch-build
Outdated
| use_s390_no_pic_data_is_text_relative_flag() | ||
| { | ||
| if kernel_is_rhel; then | ||
| ! rhel_kernel_version_gte 5.14.0-596.el9 |
There was a problem hiding this comment.
I believe -595 was the first version with that commit. Though is there a need to check RHEL here? At least I don't think Red Hat supports livepatch for s390.
There was a problem hiding this comment.
Yeah kernel-5.14.0-595.el9 would have introduced the backport for c98d2ecae08f:
$ git tag --contains b0e3825d73c3eeaec80b1ce42012050e075bd335 | grep kernel | sort -V | head -n1
kernel-5.14.0-595.el9As far as support goes, the s390x el9 kernel should have all the commits to support kpatch/livepatching, but there is no s390x Red Hat CVE kpatch service to date.
There was a problem hiding this comment.
We actively test kpatch on our internal ci (upstream kernel) and we have all the required s390 prerequisite for kpatch. Test team will also rely on rhel distros for kpatch verification. I will change it to kernel-5.14.0-595.el9. Thank you.
There was a problem hiding this comment.
Added v2 with rhel version update.
s390 -mno-pic-data-is-text-relative prevents relative addressing between
code and data. The cflag option was introduced to avoid PC32 relocation
errors when the kpatch text and data segments are placed far apart.
However, since the Linux kernel commit c98d2ecae08f ("s390/mm: Uncouple
physical vs virtual address spaces"), the kernel, modules, and data
segments remain close to each other, and therefore no longer risk PC32
relocation errors.
Additionally, with the recent kernel commit 04dabb4261c3 ("s390/bug:
Implement __WARN_printf()")
git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-next branch,
it has inline assembly which uses string literals as immediate operands.
gcc fails to compile kpatch module when -mno-pic-data-is-text-relative
is used.
Therefore, restrict the use of -mno-pic-data-is-text-relative to kernels
prior to commit c98d2ecae08f.
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
72b0196 to
dd1bd9a
Compare
s390 -mno-pic-data-is-text-relative prevents relative addressing between code and data. The cflag option was introduced to avoid PC32 relocation errors when the kpatch text and data segments are placed far apart.
However, since the Linux kernel commit c98d2ecae08f ("s390/mm: Uncouple physical vs virtual address spaces"), the kernel, modules, and data segments remain close to each other, and therefore no longer risk PC32 relocation errors.
Additionally, with the recent kernel commit 04dabb4261c3 ("s390/bug: Implement __WARN_printf()")
git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-next branch, it has inline assembly which uses string literals as immediate operands. gcc fails to compile kpatch module when -mno-pic-data-is-text-relative is used.
Therefore, restrict the use of -mno-pic-data-is-text-relative to kernels prior to commit c98d2ecae08f.