X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/eb6b6ca394357805f2bdba989abae309f718b4d8..f427ee49d309d8fc33ebf3042c3a775f2f530ded:/osfmk/kern/suid_cred.c diff --git a/osfmk/kern/suid_cred.c b/osfmk/kern/suid_cred.c index b876d731c..c2a963d04 100644 --- a/osfmk/kern/suid_cred.c +++ b/osfmk/kern/suid_cred.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Apple Inc. All rights reserved. + * Copyright (c) 2019-2020 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -61,8 +61,6 @@ struct ucred; extern int kauth_cred_issuser(struct ucred *); extern struct ucred *kauth_cred_get(void); -static struct zone *suid_cred_zone = NULL; - /* Data associated with the suid cred port. Consumed during posix_spawn(). */ struct suid_cred { ipc_port_t port; @@ -70,6 +68,9 @@ struct suid_cred { uint32_t uid; }; +static ZONE_DECLARE(suid_cred_zone, "suid_cred", + sizeof(struct suid_cred), ZC_NONE); + /* Allocs a new suid credential. The vnode reference will be owned by the newly * created suid_cred_t. */ static suid_cred_t @@ -142,7 +143,7 @@ convert_suid_cred_to_port(suid_cred_t sc) } if (!ipc_kobject_make_send_lazy_alloc_port(&sc->port, - (ipc_kobject_t) sc, IKOT_SUID_CRED)) { + (ipc_kobject_t) sc, IKOT_SUID_CRED, false, 0)) { suid_cred_free(sc); return IP_NULL; } @@ -190,13 +191,6 @@ suid_cred_verify(ipc_port_t port, struct vnode *vnode, uint32_t *uid) return ret; } -void -suid_cred_init(void) -{ - const size_t sc_size = sizeof(struct suid_cred); - suid_cred_zone = zinit(sc_size, 1024 * sc_size, 0, "suid_cred"); -} - kern_return_t task_create_suid_cred( task_t task,