Skip to content

Commit 011ef29

Browse files
committed
Merge: enable CONFIG_WERROR=y
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/636 JIRA: https://issues.redhat.com/browse/RHEL-85334 Enable CONFIG_WERROR for c10s. Signed-off-by: Jan Stancek <jstancek@redhat.com> Approved-by: Joe Lawrence <joe.lawrence@redhat.com> Approved-by: Scott Weaver <scweaver@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents b53b130 + 7fbaa45 commit 011ef29

29 files changed

+46
-28
lines changed

include/linux/fortify-string.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,21 +616,33 @@ __FORTIFY_INLINE bool fortify_memcpy_chk(__kernel_size_t size,
616616
return false;
617617
}
618618

619+
/*
620+
* To work around what seems to be an optimizer bug, the macro arguments
621+
* need to have const copies or the values end up changed by the time they
622+
* reach fortify_warn_once(). See commit 6f7630b1b5bc ("fortify: Capture
623+
* __bos() results in const temp vars") for more details.
624+
*/
619625
#define __fortify_memcpy_chk(p, q, size, p_size, q_size, \
620626
p_size_field, q_size_field, op) ({ \
621627
const size_t __fortify_size = (size_t)(size); \
622628
const size_t __p_size = (p_size); \
623629
const size_t __q_size = (q_size); \
624630
const size_t __p_size_field = (p_size_field); \
625631
const size_t __q_size_field = (q_size_field); \
632+
/* Keep a mutable version of the size for the final copy. */ \
633+
size_t __copy_size = __fortify_size; \
626634
fortify_warn_once(fortify_memcpy_chk(__fortify_size, __p_size, \
627635
__q_size, __p_size_field, \
628636
__q_size_field, FORTIFY_FUNC_ ##op), \
629637
#op ": detected field-spanning write (size %zu) of single %s (size %zu)\n", \
630638
__fortify_size, \
631639
"field \"" #p "\" at " FILE_LINE, \
632640
__p_size_field); \
633-
__underlying_##op(p, q, __fortify_size); \
641+
/* Hide only the run-time size from value range tracking to */ \
642+
/* silence compile-time false positive bounds warnings. */ \
643+
if (!__builtin_constant_p(__copy_size)) \
644+
OPTIMIZER_HIDE_VAR(__copy_size); \
645+
__underlying_##op(p, q, __copy_size); \
634646
})
635647

636648
/*

redhat/Makefile.variables

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ DIST ?= .el10
4747
DISTRO ?=
4848

4949
# This overrides CONFIG_WERROR to 'y' for all arches. RHEL requires this variable to be set.
50-
ENABLE_WERROR ?=
50+
ENABLE_WERROR ?= 1
5151

5252
# This is the executable for 'git' commands. It is used by the redhat/self-test
5353
# tests to provide testing information on git hashes (see redhat/self-test/egit.sh)

redhat/configs/build_configs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function merge_configs()
115115

116116
if [ -n "$ENABLE_WERROR" ]; then
117117
sed -i "s|# CONFIG_WERROR is not set|CONFIG_WERROR=y|g" "$name"
118+
sed -i "s|# CONFIG_KVM_WERROR is not set|CONFIG_KVM_WERROR=y|g" "$name"
118119
fi
119120

120121
rm -f config-merged."$count" config-merging."$count"

redhat/self-test/data/centos-2585cf9dfaad.el7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.el7
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=2585cf9dfaaddf00b069673f27bb3f8530e2039c

redhat/self-test/data/centos-2585cf9dfaad.fc25

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.fc25
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=2585cf9dfaaddf00b069673f27bb3f8530e2039c

redhat/self-test/data/centos-78e36f3b0dae.el7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.el7
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=78e36f3b0dae586f623c4a37ec5eb5496f5abbe1

redhat/self-test/data/centos-78e36f3b0dae.fc25

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.fc25
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=78e36f3b0dae586f623c4a37ec5eb5496f5abbe1

redhat/self-test/data/centos-df0cc57e057f.el7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.el7
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=df0cc57e057f18e44dac8e6c18aba47ab53202f9

redhat/self-test/data/centos-df0cc57e057f.fc25

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.fc25
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=df0cc57e057f18e44dac8e6c18aba47ab53202f9

redhat/self-test/data/centos-fce15c45d3fb.el7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISTRO_USERDEF=centos
2323
DIST_USERDEF=.el7
2424
EARLY_YBUILD=
2525
EARLY_YRELEASE=
26-
ENABLE_WERROR=
26+
ENABLE_WERROR=1
2727
FLAVOR=
2828
GIT=git
2929
GITID=fce15c45d3fbd9fc1feaaf3210d8e3f8b33dfd3a

0 commit comments

Comments
 (0)