Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_ktrace.c
| Show First 20 Lines • Show All 917 Lines • ▼ Show 20 Lines | ktrstructarray(const char *name, enum uio_seg seg, const void *data, | ||||
| ksa = &req->ktr_data.ktr_struct_array; | ksa = &req->ktr_data.ktr_struct_array; | ||||
| ksa->struct_size = struct_size; | ksa->struct_size = struct_size; | ||||
| req->ktr_buffer = buf; | req->ktr_buffer = buf; | ||||
| req->ktr_header.ktr_len = buflen; | req->ktr_header.ktr_len = buflen; | ||||
| ktr_submitrequest(curthread, req); | ktr_submitrequest(curthread, req); | ||||
| } | } | ||||
| void | void | ||||
| ktrcapfail(enum ktr_cap_fail_type type, const cap_rights_t *needed, | ktrcapfail(enum ktr_cap_violation type, const void *data) | ||||
| const cap_rights_t *held) | |||||
| { | { | ||||
| struct thread *td = curthread; | struct thread *td = curthread; | ||||
| struct ktr_request *req; | struct ktr_request *req; | ||||
| struct ktr_cap_fail *kcf; | struct ktr_cap_fail *kcf; | ||||
| union ktr_cap_data *kcd; | |||||
| if (__predict_false(curthread->td_pflags & TDP_INKTRACE)) | if (__predict_false(td->td_pflags & TDP_INKTRACE)) | ||||
| return; | return; | ||||
| if (type != CAPFAIL_SYSCALL && | |||||
| (td->td_sa.callp->sy_flags & SYF_CAPENABLED) == 0) | |||||
| return; | |||||
| req = ktr_getrequest(KTR_CAPFAIL); | req = ktr_getrequest(KTR_CAPFAIL); | ||||
| if (req == NULL) | if (req == NULL) | ||||
| return; | return; | ||||
| kcf = &req->ktr_data.ktr_cap_fail; | kcf = &req->ktr_data.ktr_cap_fail; | ||||
| kcf->cap_type = type; | kcf->cap_type = type; | ||||
| if (needed != NULL) | kcf->cap_code = td->td_sa.code; | ||||
| kcf->cap_needed = *needed; | kcf->cap_svflags = td->td_proc->p_sysent->sv_flags; | ||||
| else | if (data != NULL) { | ||||
| cap_rights_init(&kcf->cap_needed); | kcd = &kcf->cap_data; | ||||
| if (held != NULL) | switch (type) { | ||||
| kcf->cap_held = *held; | case CAPFAIL_NOTCAPABLE: | ||||
| else | case CAPFAIL_INCREASE: | ||||
| cap_rights_init(&kcf->cap_held); | kcd->cap_needed = *(const cap_rights_t *)data; | ||||
| kcd->cap_held = *((const cap_rights_t *)data + 1); | |||||
| break; | |||||
| case CAPFAIL_SYSCALL: | |||||
| case CAPFAIL_SIGNAL: | |||||
| case CAPFAIL_PROTO: | |||||
| kcd->cap_int = *(const int *)data; | |||||
| break; | |||||
| case CAPFAIL_SOCKADDR: | |||||
| kcd->cap_sockaddr = *(const struct sockaddr *)data; | |||||
| break; | |||||
| case CAPFAIL_NAMEI: | |||||
| strlcpy(kcd->cap_path, data, MAXPATHLEN); | |||||
| break; | |||||
| case CAPFAIL_CPUSET: | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| ktr_enqueuerequest(td, req); | ktr_enqueuerequest(td, req); | ||||
| ktrace_exit(td); | ktrace_exit(td); | ||||
| } | } | ||||
| void | void | ||||
| ktrfault(vm_offset_t vaddr, int type) | ktrfault(vm_offset_t vaddr, int type) | ||||
| { | { | ||||
| struct thread *td = curthread; | struct thread *td = curthread; | ||||
| ▲ Show 20 Lines • Show All 441 Lines • Show Last 20 Lines | |||||