Details
- Reviewers
brooks
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Not tested, but at least it compiles.
The formatting of the errors to display them to user is not implemented: uexterr_gettext() is a stub.
I only added two places for mmap() to demonstrate use of the kernel interface.
Over all this looks great.
I'm on the fence about extending struct pthread on vs adding avoid additional mallocs. It's certainly simplifying, but people might want it off in some cases (e.g., if the kernel doesn't include messages or the developer isn't using APIs they think would benefit from extra explanations.)
sys/kern/sys_generic.c | ||
---|---|---|
2239 | Enforce uap->flags == 0? | |
2244 | I wonder if it makes more sense to encode the version in the flags and not try to dance around its presence in the structure. | |
2257 | IMO this shouldn't exist. If part of the thread's execution doesn't know where the buffer is that should be respected. If we want to leak the pointer for diagnostic purposes let's do it without provenance via kinfo_proc. I'd almost certainly disable this on CheriABI. | |
sys/kern/syscalls.master | ||
3356 | There annotation should probably be _Inout_updates_bytes_opt_(sizeof(struct uexterror)), but you might need to hardcode the value rather than using sizeof. | |
sys/sys/exterrvar.h | ||
28 | I wonder if EXTERR_CATEGORY is the right name. It's effectively the file in this design. |
Then how would it disabled?
FWIW, I indeed can do 'malloc; exterrctl(); if error {free}' in libthr. But I do not see a good option for the libc.
sys/kern/sys_generic.c | ||
---|---|---|
2239 | Flags are used in the current version, I added the check for valid bits. | |
2244 | IMO signatures are useful. If only for debugging. | |
sys/kern/syscalls.master | ||
3356 | No, I do not think so. I changed it to _In_reads_bytes_(4), this is all what this syscall does. Assuming the direct reading the spec as plain english is correct. And there is similar annotation bug for sigfastblock(2), I suspect. | |
sys/sys/exterrvar.h | ||
28 | I wanted to automatically convert the source path of the compiled files (perhaps with everything before sys/ trimmed) into some identifier, easily mapped back. I was not able to create a scheme that did not require an additional build artifact to be consulted afterward. So I renamed that to category. For instance, I imagined that kern_descrip.c and sys_generic.c fall into same EXTERR_CAT_FILEDESC name. I certainly can rename this to EXTERR_FILEID or use a different scheme of generating something to match source lines. |
Fix hand-off from libc to libthr.
Generate SIGSEGV on EFAULT from copyout of the exterr.
Remove getptr.
Report exterr address through kinfo_proc.
Still not tested.
Fix fork and exec.
Add sysconf() to get max exterr buffer
Provide real exterr format procedure
Fixed flags handling in syscall
This version works.
I'm still not a big fan of putting the strings in the kernel syscall ABI (as i guarantee someone's gonna end up writing stuff that depends upon the content of the strings!), but I /am/ a fan of how the kernel source is being updated with errors. We can at least grep for the macro use to see what they're doing, and they're a no-op if it's not compiled in.