diff options
| author | Jamie Gritton <jamie@FreeBSD.org> | 2025-09-09 18:13:11 +0000 |
|---|---|---|
| committer | Jamie Gritton <jamie@FreeBSD.org> | 2025-09-09 18:13:11 +0000 |
| commit | 16f600dc30b7bb82429660e540da802a1e3f7449 (patch) | |
| tree | 48fed6dbb48392a82cdcf131ee149a1d7303a246 | |
| parent | 46347b3619757e3d683a87ca03efaf2ae242335f (diff) | |
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
| -rw-r--r-- | lib/libsys/jail.2 | 26 | ||||
| -rw-r--r-- | sys/kern/kern_jaildesc.c | 2 |
2 files changed, 7 insertions, 21 deletions
diff --git a/lib/libsys/jail.2 b/lib/libsys/jail.2 index a0f47cc61cb3..a2640071d1f0 100644 --- a/lib/libsys/jail.2 +++ b/lib/libsys/jail.2 @@ -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. diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c index fec9b5719b2e..b4ffad4c88e8 100644 --- a/sys/kern/kern_jaildesc.c +++ b/sys/kern/kern_jaildesc.c @@ -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; |
