Document open(2) and openat(2) behavior in Capsicum capability mode.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | might be good to mention that it is a DIRECTORY descriptor |
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | That's covered on line 79-80. In this paragraph, I just want to highlight the difference in behavior in the capability mode sandbox. |
lib/libc/sys/open.2 | ||
---|---|---|
108 ↗ | (On Diff #20473) | I'm not sure this is true. I thought the actual rules were:
"a/../b/../c/d/../.." is okay. "a/../../b" is not. |
lib/libc/sys/open.2 | ||
---|---|---|
108 ↗ | (On Diff #20473) | https://github.com/freebsd/freebsd/blob/master/sys/kern/vfs_lookup.c#L619-L644 I don't think ".." is allowed at all. |
lib/libc/sys/open.2 | ||
---|---|---|
108 ↗ | (On Diff #20473) | Ah, got it. Then disregard my comment. :-) |
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | It's hard to tell what the quote marks mean. They kind of look sarcastic, and might give the opposite of the intended meaning. But the intended meaning is not clear. Maybe remove the quotes and be more specific about the term, or use .Xr to refer to a definition. |
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | This is a technical document; they're not sarcasm quotes. They refer to a specific clause with identical quotation in the source code. There's no definition elsewhere in .Xr. 201 #ifdef CAPABILITY_MODE 202 /* 203 * In capability mode, lookups must be "strictly relative" (i.e. 204 * not an absolute path, and not containing '..' components) to 205 * a real file descriptor, not the pseudo-descriptor AT_FDCWD. 206 */ |
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | Maybe just removing the quotes is a good solution? |
lib/libc/sys/open.2 | ||
---|---|---|
105 ↗ | (On Diff #20473) | And possibly add a reference to the source file: must be strictly relative to a real file descriptor .Fa fd , as defined in .Pa sys/kern/vfs_lookup.c . |
In general, this seems like a good idea. A bit of wordsmithing does help, and reviewing an updated commit candidate before it goes into the tree wouldn't hurt if you can tolerate another RTT with reviewers :-).
lib/libc/sys/open.2 | ||
---|---|---|
98 ↗ | (On Diff #20473) | I wonder if an explicit .Xr to capsicum(4) might be appropriate here? |
112 ↗ | (On Diff #20473) | I'm not sure we need to mention bogus values? People who pass bogus values to openat(2) deserve failure modes. Just to confirm the above: no use of "..", either in the string passed, nor in symbolic links, is permitted in paths looked up in capability mode. |
- Xr capsicum 4
- Specify symlinks may not contain .. too
- Remove mention of bogus fd values
lib/libc/sys/open.2 | ||
---|---|---|
107 ↗ | (On Diff #20873) | I would drop "real" here. |
Remove "real". File descriptor + no AT_FDCWD later in paragraph is sufficient, per emaste@.