Fix panic in ktrcapfail() when no capability rights are passed.
While here, correct all consumers to pass NULL instead of 0 as we pass capability rights as pointers now, not uint64_t. Reported by: Daniel Peyrolon Tested by: Daniel Peyrolon Approved by: re (marius)
This commit is contained in:
parent
9e8e4eba85
commit
667d7255be
@ -209,7 +209,7 @@ sysarch(td, uap)
|
||||
default:
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
|
||||
ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
|
||||
#endif
|
||||
return (ECAPMODE);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ sysarch(td, uap)
|
||||
default:
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
|
||||
ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
|
||||
#endif
|
||||
return (ECAPMODE);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ sysarch(td, uap)
|
||||
default:
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
|
||||
ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
|
||||
#endif
|
||||
return (ECAPMODE);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "opt_ktrace.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/capability.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -791,8 +792,14 @@ ktrcapfail(type, needed, held)
|
||||
return;
|
||||
kcf = &req->ktr_data.ktr_cap_fail;
|
||||
kcf->cap_type = type;
|
||||
kcf->cap_needed = *needed;
|
||||
kcf->cap_held = *held;
|
||||
if (needed != NULL)
|
||||
kcf->cap_needed = *needed;
|
||||
else
|
||||
cap_rights_init(&kcf->cap_needed);
|
||||
if (held != NULL)
|
||||
kcf->cap_held = *held;
|
||||
else
|
||||
cap_rights_init(&kcf->cap_held);
|
||||
ktr_enqueuerequest(td, req);
|
||||
ktrace_exit(td);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ namei(struct nameidata *ndp)
|
||||
if (ndp->ni_dirfd == AT_FDCWD) {
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
|
||||
ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
|
||||
#endif
|
||||
error = ECAPMODE;
|
||||
}
|
||||
@ -284,7 +284,7 @@ namei(struct nameidata *ndp)
|
||||
if (ndp->ni_strictrelative != 0) {
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(curthread, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
|
||||
ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
|
||||
#endif
|
||||
return (ENOTCAPABLE);
|
||||
}
|
||||
@ -640,7 +640,7 @@ dirloop:
|
||||
if (ndp->ni_strictrelative != 0) {
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(curthread, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
|
||||
ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
|
||||
#endif
|
||||
error = ENOTCAPABLE;
|
||||
goto bad;
|
||||
|
@ -71,7 +71,7 @@ sysarch(struct thread *td, struct sysarch_args *uap)
|
||||
default:
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CAPFAIL))
|
||||
ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
|
||||
ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
|
||||
#endif
|
||||
return (ECAPMODE);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user