diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1877,7 +1877,7 @@ __func__, cr->cr_users, cr)); cr->cr_users--; if (cr->cr_users == 0) { - KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p", + KASSERT(cr->cr_ref > 0, ("%s: ref %ld not > 0 on cred %p", __func__, cr->cr_ref, cr)); crold = cr; } else { @@ -1905,7 +1905,7 @@ mtx_unlock(&cr->cr_mtx); return; } - KASSERT(cr->cr_ref >= 0, ("%s: ref %d not >= 0 on cred %p", + KASSERT(cr->cr_ref >= 0, ("%s: ref %ld not >= 0 on cred %p", __func__, cr->cr_ref, cr)); if (cr->cr_ref > 0) { mtx_unlock(&cr->cr_mtx); @@ -2051,7 +2051,7 @@ mtx_unlock(&cr->cr_mtx); return; } - KASSERT(cr->cr_ref >= 0, ("%s: ref %d not >= 0 on cred %p", + KASSERT(cr->cr_ref >= 0, ("%s: ref %ld not >= 0 on cred %p", __func__, cr->cr_ref, cr)); if (cr->cr_ref > 0) { mtx_unlock(&cr->cr_mtx); @@ -2066,7 +2066,7 @@ KASSERT(cr->cr_users == 0, ("%s: users %d not == 0 on cred %p", __func__, cr->cr_users, cr)); - KASSERT(cr->cr_ref == 0, ("%s: ref %d not == 0 on cred %p", + KASSERT(cr->cr_ref == 0, ("%s: ref %ld not == 0 on cred %p", __func__, cr->cr_ref, cr)); /* @@ -2104,6 +2104,7 @@ bcopy(&src->cr_startcopy, &dest->cr_startcopy, (unsigned)((caddr_t)&src->cr_endcopy - (caddr_t)&src->cr_startcopy)); + dest->cr_flags = src->cr_flags; crsetgroups(dest, src->cr_ngroups, src->cr_groups); uihold(dest->cr_uidinfo); uihold(dest->cr_ruidinfo); @@ -2210,7 +2211,7 @@ mtx_lock(&cr->cr_mtx); cr->cr_users--; if (cr->cr_users == 0) - KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p", + KASSERT(cr->cr_ref > 0, ("%s: ref %ld not > 0 on cred %p", __func__, cr->cr_ref, cr)); mtx_unlock(&cr->cr_mtx); crfree(cr); diff --git a/sys/sys/proc.h b/sys/sys/proc.h --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -321,7 +321,7 @@ int td_errno; /* (k) Error from last syscall. */ size_t td_vslock_sz; /* (k) amount of vslock-ed space */ struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */ - u_int td_ucredref; /* (k) references on td_realucred */ + long td_ucredref; /* (k) references on td_realucred */ #define td_endzero td_sigmask /* Copied during fork1(), thread_create(), or kthread_add(). */ diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -61,8 +61,9 @@ #if defined(_KERNEL) || defined(_WANT_UCRED) struct ucred { struct mtx cr_mtx; - u_int cr_ref; /* (c) reference count */ + long cr_ref; /* (c) reference count */ u_int cr_users; /* (c) proc + thread using this cred */ + u_int cr_flags; /* credential flags */ struct auditinfo_addr cr_audit; /* Audit properties. */ #define cr_startcopy cr_uid uid_t cr_uid; /* effective user id */ @@ -75,7 +76,6 @@ struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */ struct prison *cr_prison; /* jail(2) */ struct loginclass *cr_loginclass; /* login class */ - u_int cr_flags; /* credential flags */ void *cr_pspare2[2]; /* general use 2 */ #define cr_endcopy cr_label struct label *cr_label; /* MAC label */