On Sun, 26 Oct 2025 at 21:53, Mike Jonkmans <[email protected]> wrote:

> On Thu, Oct 23, 2025 at 07:35:38PM -0400, Pepper Gray wrote:
> > URL:
> >   <https://savannah.gnu.org/bugs/?67624>
> > Traces for the failing commands are available in the downstream bug
> report:
> > https://bugs.gentoo.org/964994
>
> It seems that this is a consequence of the kernel handling writes to
> /proc/...
> The musl implementation makes it two separate write calls,
> which the kernel does not accept.


> I don't think that bash should solve this (even if it could).
>

Looking in the openwall report, it appears to be a procfs kernel bug, as it
has two “limitations” that each alone wouldn't matter but together cause
problems.

On the one hand, procfs requires unitary writes of the entire file content
in one go; but on the other hand, it truncates writes when writev is used
with more than one element in its iovec:

laas:~# cat t.sh
#!/bin/bash
echo 60 > /proc/sys/kernel/panic
laas:~# strace -f t.sh
...
writev(1, [{"60", 2}, {"\n", 1}], 2) = 2
writev(1, [{"", 0}, {"\n", 1}], 2) = -1 EINVAL (Invalid argument)


Either one of these would not matter, but taken together they cause the
issue exhibited by “echo” when using musl for stdio.

I guess “echo” could be adjusted to buffer the line before outputting it,
but that would just hide the underlying issue.

Anyone game for lodging a kernel bug report?

-Martin

Reply via email to