jaildesc: replace EBADF with EINVAL

Following fd9e09cb, EBADF is not the suitable error code for a non-
jail descriptor passed to jail_set, jail_get, jail_attach_fd, and
jail_remove_fd.

Reported by:	kib
This commit is contained in:
Jamie Gritton
2025-09-09 11:13:11 -07:00
parent 46347b3619
commit 16f600dc30
2 changed files with 7 additions and 21 deletions
+6 -20
View File
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd September 4, 2025
.Dd September 9, 2025
.Dt JAIL 2
.Os
.Sh NAME
@@ -402,15 +402,6 @@ The
system call
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
The
.Va desc
parameter does not refer to a valid jail descriptor,
and either the
.Dv JAIL_USE_DESC
or
.Dv JAIL_AT_DESC
flag was set.
.It Bq Er EACCES
Write permission is denied on the jail descriptor in the
.Va desc
@@ -514,15 +505,6 @@ The
system call
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
The
.Va desc
parameter does not refer to a valid jail descriptor,
and either the
.Dv JAIL_USE_DESC
or
.Dv JAIL_AT_DESC
flag was set.
.It Bq Er EACCES
Read permission is denied on the jail descriptor in the
.Va desc
@@ -564,6 +546,10 @@ parameter has been removed
.It Bq Er EINVAL
A supplied parameter is the wrong size.
.It Bq Er EINVAL
A supplied parameter is out of range.
.It Bq Er EINVAL
A supplied string parameter is not null-terminated.
.It Bq Er EINVAL
A supplied parameter name does not match any known parameters.
.It Bq Er EMFILE
A jail descriptor could not be created for the
@@ -607,7 +593,7 @@ and
system calls
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.It Bq Er EINVAL
The
.Fa fd
argument is not a valid jail descriptor.
+1 -1
View File
@@ -87,7 +87,7 @@ jaildesc_find(struct thread *td, int fd, struct jaildesc **jdp,
if (error != 0)
return (error);
if (fp->f_type != DTYPE_JAILDESC) {
error = EBADF;
error = EINVAL;
goto out;
}
jd = fp->f_data;