mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
jail_{get,set}: user_ implementations
This will enable compat implementations in the future. Reviewed by: jamie, jhb Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D60026
This commit is contained in:
1 parent
afe41f1ab9
commit
2127135a22
2 files changed
+29
-8
No files matched your search
+24
-8
@@ -575,18 +575,26 @@ kern_jail(struct thread *td, struct jail *j)
|
||||
*/
|
||||
int
|
||||
sys_jail_set(struct thread *td, struct jail_set_args *uap)
|
||||
{
|
||||
return (user_jail_set(td, uap->iovp, uap->iovcnt, uap->flags,
|
||||
copyinuio));
|
||||
}
|
||||
|
||||
int
|
||||
user_jail_set(struct thread *td, struct iovec *iovp,
|
||||
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f)
|
||||
{
|
||||
struct uio *auio;
|
||||
int error;
|
||||
|
||||
/* Check that we have an even number of iovecs. */
|
||||
if (uap->iovcnt & 1)
|
||||
if (iovcnt & 1)
|
||||
return (EINVAL);
|
||||
|
||||
error = copyinuio(uap->iovp, uap->iovcnt, &auio);
|
||||
error = copyinuio_f(iovp, iovcnt, &auio);
|
||||
if (error)
|
||||
return (error);
|
||||
error = kern_jail_set(td, auio, uap->flags);
|
||||
error = kern_jail_set(td, auio, flags);
|
||||
freeuio(auio);
|
||||
return (error);
|
||||
}
|
||||
@@ -2560,21 +2568,29 @@ get_next_deadid(struct prison **dinsprp)
|
||||
*/
|
||||
int
|
||||
sys_jail_get(struct thread *td, struct jail_get_args *uap)
|
||||
{
|
||||
return (user_jail_get(td, uap->iovp, uap->iovcnt, uap->flags,
|
||||
copyinuio, updateiov));
|
||||
}
|
||||
|
||||
int
|
||||
user_jail_get(struct thread *td, struct iovec *iovp,
|
||||
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f,
|
||||
updateiov_t *updateiov_f)
|
||||
{
|
||||
struct uio *auio;
|
||||
int error;
|
||||
|
||||
/* Check that we have an even number of iovecs. */
|
||||
if (uap->iovcnt & 1)
|
||||
if (iovcnt & 1)
|
||||
return (EINVAL);
|
||||
|
||||
error = copyinuio(uap->iovp, uap->iovcnt, &auio);
|
||||
error = copyinuio_f(iovp, iovcnt, &auio);
|
||||
if (error)
|
||||
return (error);
|
||||
error = kern_jail_get(td, auio, uap->flags);
|
||||
error = kern_jail_get(td, auio, flags);
|
||||
if (error == 0)
|
||||
error = copyout(auio->uio_iov, uap->iovp,
|
||||
uap->iovcnt * sizeof(struct iovec));
|
||||
error = updateiov_f(auio, iovp);
|
||||
freeuio(auio);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@@ -445,6 +445,11 @@ int user_cpuset_getaffinity(struct thread *td, cpulevel_t level,
|
||||
int user_cpuset_setaffinity(struct thread *td, cpulevel_t level,
|
||||
cpuwhich_t which, id_t id, size_t cpusetsize,
|
||||
const cpuset_t *maskp, const struct cpuset_copy_cb *cb);
|
||||
int user_jail_get(struct thread *td, struct iovec *iovp,
|
||||
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f,
|
||||
updateiov_t *updateiov_f);
|
||||
int user_jail_set(struct thread *td, struct iovec *iovp,
|
||||
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f);
|
||||
|
||||
/* flags for kern_sigaction */
|
||||
#define KSA_OSIGSET 0x0001 /* uses osigact_t */
|
||||
|
||||
Reference in new issue
Block a user