[LTP] [PATCH 1/1] lib: dirtyc0w_shmem: userfaultfd01: Add safe_userfaultfd()
Cyril Hrubis
chrubis@suse.cz
Wed Nov 5 11:30:19 CET 2025
Hi!
> > + } else if (ret < 0) {
> > + tst_brk_(file, lineno, TBROK | TERRNO,
> > + "Invalid syscall(__NR_userfaultfd, %d) return value %d", flags, ret);
> > + }
> I suppose main error handle if (ret == -1) already cover standard syscall
> error, why still need check ret < 0 ?
We are testing kernel and we have to check for situation that are
impossible under normal operation. There have been cases when a bug in a
kernel patch caused the syscall to return invalid return values, so we
are making extra sure that this does not happen.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list