On Sun, Jan 11, 2026 at 06:32:31PM +0000, Pádraig Brady wrote:
> FYI we've just pushed a new test in the attached that uses
> strace to inject errors for testing, like:
>
> $ strace -o /dev/null -P /dev/null -e fault=read:error=EIO \
> cat /dev/null
> cat: /dev/null: Input/output error
Since it's not guaranteed that the syscall issued by libc would
necessarily be read (it could be a syscall from readv family instead),
I'd recommend using a wide regexp like /read instead, e.g.
$ strace -o /dev/null -P /dev/null -e trace=/read -e fault=all:error=EIO \
cat /dev/null
Also note that since you're not interested in tracing non-read syscalls,
you can explicitly limit the set of syscalls being traced to those you're
going to tamper with, and inject errors into all syscalls being traced,
like in this example, all /read syscalls dealing with /dev/null.
--
ldv