release 6.14.5
This commit is contained in:
80
debian/patches/patchset-pf/fixes/0008-gcc-15-make-unterminated-string-initialization-just-.patch
vendored
Normal file
80
debian/patches/patchset-pf/fixes/0008-gcc-15-make-unterminated-string-initialization-just-.patch
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
From 45a91b33b7de48d4ee8875d2fcc6be04d7e3919c Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Sun, 20 Apr 2025 10:33:23 -0700
|
||||
Subject: gcc-15: make 'unterminated string initialization' just a warning
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
gcc-15 enabling -Wunterminated-string-initialization in -Wextra by
|
||||
default was done with the best intentions, but the warning is still
|
||||
quite broken.
|
||||
|
||||
What annoys me about the warning is that this is a very traditional AND
|
||||
CORRECT way to initialize fixed byte arrays in C:
|
||||
|
||||
unsigned char hex[16] = "0123456789abcdef";
|
||||
|
||||
and we use this all over the kernel. And the warning is fine, but gcc
|
||||
developers apparently never made a reasonable way to disable it. As is
|
||||
(sadly) tradition with these things.
|
||||
|
||||
Yes, there's "__attribute__((nonstring))", and we have a macro to make
|
||||
that absolutely disgusting syntax more palatable (ie the kernel syntax
|
||||
for that monstrosity is just "__nonstring").
|
||||
|
||||
But that attribute is misdesigned. What you'd typically want to do is
|
||||
tell the compiler that you are using a type that isn't a string but a
|
||||
byte array, but that doesn't work at all:
|
||||
|
||||
warning: ‘nonstring’ attribute does not apply to types [-Wattributes]
|
||||
|
||||
and because of this fundamental mis-design, you then have to mark each
|
||||
instance of that pattern.
|
||||
|
||||
This is particularly noticeable in our ACPI code, because ACPI has this
|
||||
notion of a 4-byte "type name" that gets used all over, and is exactly
|
||||
this kind of byte array.
|
||||
|
||||
This is a sad oversight, because the warning is useful, but really would
|
||||
be so much better if gcc had also given a sane way to indicate that we
|
||||
really just want a byte array type at a type level, not the broken "each
|
||||
and every array definition" level.
|
||||
|
||||
So now instead of creating a nice "ACPI name" type using something like
|
||||
|
||||
typedef char acpi_name_t[4] __nonstring;
|
||||
|
||||
we have to do things like
|
||||
|
||||
char name[ACPI_NAMESEG_SIZE] __nonstring;
|
||||
|
||||
in every place that uses this concept and then happens to have the
|
||||
typical initializers.
|
||||
|
||||
This is annoying me mainly because I think the warning _is_ a good
|
||||
warning, which is why I'm not just turning it off in disgust. But it is
|
||||
hampered by this bad implementation detail.
|
||||
|
||||
[ And obviously I'm doing this now because system upgrades for me are
|
||||
something that happen in the middle of the release cycle: don't do it
|
||||
before or during travel, or just before or during the busy merge
|
||||
window period. ]
|
||||
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
---
|
||||
Makefile | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1071,6 +1071,9 @@ KBUILD_CFLAGS += $(call cc-option, -fstr
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)
|
||||
|
||||
+#Currently, disable -Wunterminated-string-initialization as an error
|
||||
+KBUILD_CFLAGS += $(call cc-option, -Wno-error=unterminated-string-initialization)
|
||||
+
|
||||
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||
KBUILD_CFLAGS += -fno-strict-overflow
|
||||
|
@@ -1,80 +0,0 @@
|
||||
From ea3ec10cacc746176a25dbd74c8d168e1c096a62 Mon Sep 17 00:00:00 2001
|
||||
From: Omar Sandoval <osandov@fb.com>
|
||||
Date: Fri, 25 Apr 2025 01:51:24 -0700
|
||||
Subject: sched/eevdf: Fix se->slice being set to U64_MAX and resulting crash
|
||||
|
||||
There is a code path in dequeue_entities() that can set the slice of a
|
||||
sched_entity to U64_MAX, which sometimes results in a crash.
|
||||
|
||||
The offending case is when dequeue_entities() is called to dequeue a
|
||||
delayed group entity, and then the entity's parent's dequeue is delayed.
|
||||
In that case:
|
||||
|
||||
1. In the if (entity_is_task(se)) else block at the beginning of
|
||||
dequeue_entities(), slice is set to
|
||||
cfs_rq_min_slice(group_cfs_rq(se)). If the entity was delayed, then
|
||||
it has no queued tasks, so cfs_rq_min_slice() returns U64_MAX.
|
||||
2. The first for_each_sched_entity() loop dequeues the entity.
|
||||
3. If the entity was its parent's only child, then the next iteration
|
||||
tries to dequeue the parent.
|
||||
4. If the parent's dequeue needs to be delayed, then it breaks from the
|
||||
first for_each_sched_entity() loop _without updating slice_.
|
||||
5. The second for_each_sched_entity() loop sets the parent's ->slice to
|
||||
the saved slice, which is still U64_MAX.
|
||||
|
||||
This throws off subsequent calculations with potentially catastrophic
|
||||
results. A manifestation we saw in production was:
|
||||
|
||||
6. In update_entity_lag(), se->slice is used to calculate limit, which
|
||||
ends up as a huge negative number.
|
||||
7. limit is used in se->vlag = clamp(vlag, -limit, limit). Because limit
|
||||
is negative, vlag > limit, so se->vlag is set to the same huge
|
||||
negative number.
|
||||
8. In place_entity(), se->vlag is scaled, which overflows and results in
|
||||
another huge (positive or negative) number.
|
||||
9. The adjusted lag is subtracted from se->vruntime, which increases or
|
||||
decreases se->vruntime by a huge number.
|
||||
10. pick_eevdf() calls entity_eligible()/vruntime_eligible(), which
|
||||
incorrectly returns false because the vruntime is so far from the
|
||||
other vruntimes on the queue, causing the
|
||||
(vruntime - cfs_rq->min_vruntime) * load calulation to overflow.
|
||||
11. Nothing appears to be eligible, so pick_eevdf() returns NULL.
|
||||
12. pick_next_entity() tries to dereference the return value of
|
||||
pick_eevdf() and crashes.
|
||||
|
||||
Dumping the cfs_rq states from the core dumps with drgn showed tell-tale
|
||||
huge vruntime ranges and bogus vlag values, and I also traced se->slice
|
||||
being set to U64_MAX on live systems (which was usually "benign" since
|
||||
the rest of the runqueue needed to be in a particular state to crash).
|
||||
|
||||
Fix it in dequeue_entities() by always setting slice from the first
|
||||
non-empty cfs_rq.
|
||||
|
||||
Fixes: aef6987d8954 ("sched/eevdf: Propagate min_slice up the cgroup hierarchy")
|
||||
Signed-off-by: Omar Sandoval <osandov@fb.com>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Link: https://lkml.kernel.org/r/f0c2d1072be229e1bdddc73c0703919a8b00c652.1745570998.git.osandov@fb.com
|
||||
---
|
||||
kernel/sched/fair.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/kernel/sched/fair.c
|
||||
+++ b/kernel/sched/fair.c
|
||||
@@ -7096,9 +7096,6 @@ static int dequeue_entities(struct rq *r
|
||||
h_nr_idle = task_has_idle_policy(p);
|
||||
if (task_sleep || task_delayed || !se->sched_delayed)
|
||||
h_nr_runnable = 1;
|
||||
- } else {
|
||||
- cfs_rq = group_cfs_rq(se);
|
||||
- slice = cfs_rq_min_slice(cfs_rq);
|
||||
}
|
||||
|
||||
for_each_sched_entity(se) {
|
||||
@@ -7108,6 +7105,7 @@ static int dequeue_entities(struct rq *r
|
||||
if (p && &p->se == se)
|
||||
return -1;
|
||||
|
||||
+ slice = cfs_rq_min_slice(cfs_rq);
|
||||
break;
|
||||
}
|
||||
|
74
debian/patches/patchset-pf/fixes/0009-gcc-15-disable-Wunterminated-string-initialization-e.patch
vendored
Normal file
74
debian/patches/patchset-pf/fixes/0009-gcc-15-disable-Wunterminated-string-initialization-e.patch
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
From 4018bbbaed061f15e0b84ea36b4aa95784934a33 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Sun, 20 Apr 2025 15:30:53 -0700
|
||||
Subject: gcc-15: disable '-Wunterminated-string-initialization' entirely for
|
||||
now
|
||||
|
||||
I had left the warning around but as a non-fatal error to get my gcc-15
|
||||
builds going, but fixed up some of the most annoying warning cases so
|
||||
that it wouldn't be *too* verbose.
|
||||
|
||||
Because I like the _concept_ of the warning, even if I detested the
|
||||
implementation to shut it up.
|
||||
|
||||
It turns out the implementation to shut it up is even more broken than I
|
||||
thought, and my "shut up most of the warnings" patch just caused fatal
|
||||
errors on gcc-14 instead.
|
||||
|
||||
I had tested with clang, but when I upgrade my development environment,
|
||||
I try to do it on all machines because I hate having different systems
|
||||
to maintain, and hadn't realized that gcc-14 now had issues.
|
||||
|
||||
The ACPI case is literally why I wanted to have a *type* that doesn't
|
||||
trigger the warning (see commit d5d45a7f2619: "gcc-15: make
|
||||
'unterminated string initialization' just a warning"), instead of
|
||||
marking individual places as "__nonstring".
|
||||
|
||||
But gcc-14 doesn't like that __nonstring location that shut gcc-15 up,
|
||||
because it's on an array of char arrays, not on one single array:
|
||||
|
||||
drivers/acpi/tables.c:399:1: error: 'nonstring' attribute ignored on objects of type 'const char[][4]' [-Werror=attributes]
|
||||
399 | static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst __nonstring = {
|
||||
| ^~~~~~
|
||||
|
||||
and my attempts to nest it properly with a type had failed, because of
|
||||
how gcc doesn't like marking the types as having attributes, only
|
||||
symbols.
|
||||
|
||||
There may be some trick to it, but I was already annoyed by the bad
|
||||
attribute design, now I'm just entirely fed up with it.
|
||||
|
||||
I wish gcc had a proper way to say "this type is a *byte* array, not a
|
||||
string".
|
||||
|
||||
The obvious thing would be to distinguish between "char []" and an
|
||||
explicitly signed "unsigned char []" (as opposed to an implicitly
|
||||
unsigned char, which is typically an architecture-specific default, but
|
||||
for the kernel is universal thanks to '-funsigned-char').
|
||||
|
||||
But any "we can typedef a 8-bit type to not become a string just because
|
||||
it's an array" model would be fine.
|
||||
|
||||
But "__attribute__((nonstring))" is sadly not that sane model.
|
||||
|
||||
Reported-by: Chris Clayton <chris2553@googlemail.com>
|
||||
Fixes: 4b4bd8c50f48 ("gcc-15: acpi: sprinkle random '__nonstring' crumbles around")
|
||||
Fixes: d5d45a7f2619 ("gcc-15: make 'unterminated string initialization' just a warning")
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1071,8 +1071,8 @@ KBUILD_CFLAGS += $(call cc-option, -fstr
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)
|
||||
|
||||
-#Currently, disable -Wunterminated-string-initialization as an error
|
||||
-KBUILD_CFLAGS += $(call cc-option, -Wno-error=unterminated-string-initialization)
|
||||
+#Currently, disable -Wunterminated-string-initialization as broken
|
||||
+KBUILD_CFLAGS += $(call cc-option, -Wno-unterminated-string-initialization)
|
||||
|
||||
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||
KBUILD_CFLAGS += -fno-strict-overflow
|
35
debian/patches/patchset-pf/fixes/0010-wifi-mac80211-mark-copy_mesh_setup-as-noinline.patch
vendored
Normal file
35
debian/patches/patchset-pf/fixes/0010-wifi-mac80211-mark-copy_mesh_setup-as-noinline.patch
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
From f762c206076d274ecb0e2f3d9b6cbca361ebb246 Mon Sep 17 00:00:00 2001
|
||||
From: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
Date: Thu, 1 May 2025 20:22:53 +0200
|
||||
Subject: wifi: mac80211: mark copy_mesh_setup() as noinline
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
With -O3 and GCC v15.1, the following happens:
|
||||
|
||||
```
|
||||
In function ‘fortify_memcpy_chk’,
|
||||
inlined from ‘copy_mesh_setup’ at net/mac80211/cfg.c:2541:2,
|
||||
inlined from ‘ieee80211_join_mesh’ at net/mac80211/cfg.c:2694:8:
|
||||
./include/linux/fortify-string.h:571:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
|
||||
```
|
||||
|
||||
Maybe, it's time to abandon -O3 altogether?
|
||||
|
||||
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
---
|
||||
net/mac80211/cfg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/net/mac80211/cfg.c
|
||||
+++ b/net/mac80211/cfg.c
|
||||
@@ -2502,7 +2502,7 @@ static inline bool _chg_mesh_attr(enum n
|
||||
return (mask >> (parm-1)) & 0x1;
|
||||
}
|
||||
|
||||
-static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
|
||||
+static noinline int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
|
||||
const struct mesh_setup *setup)
|
||||
{
|
||||
u8 *new_ie;
|
Reference in New Issue
Block a user