Date: Tue, 9 Sep 2025 18:18:02 GMT From: Jamie Gritton <jamie@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 16f600dc30b7 - main - jaildesc: replace EBADF with EINVAL Message-ID: <202509091818.589II2D2005924@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=16f600dc30b7bb82429660e540da802a1e3f7449 commit 16f600dc30b7bb82429660e540da802a1e3f7449 Author: Jamie Gritton <jamie@FreeBSD.org> AuthorDate: 2025-09-09 18:13:11 +0000 Commit: Jamie Gritton <jamie@FreeBSD.org> CommitDate: 2025-09-09 18:13:11 +0000 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 --- lib/libsys/jail.2 | 26 ++++++-------------------- 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509091818.589II2D2005924>