[LTP] [PATCH 1/1] lib: dirtyc0w_shmem: userfaultfd01: Add safe_userfaultfd()

Wei Gao wegao@suse.com
Wed Nov 5 13:05:48 CET 2025


On Wed, Nov 05, 2025 at 11:30:19AM +0100, Cyril Hrubis wrote:
> 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.
Thanks for the explanation. 
Reviewed-by: Wei Gao <wegao@suse.com>
> 
> -- 
> Cyril Hrubis
> chrubis@suse.cz


More information about the ltp mailing list