{"action":"created","issue":{"url":"https://api.github.com/repos/google/capsicum-test/issues/15","repository_url":"https://api.github.com/repos/google/capsicum-test","labels_url":"https://api.github.com/repos/google/capsicum-test/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/google/capsicum-test/issues/15/comments","events_url":"https://api.github.com/repos/google/capsicum-test/issues/15/events","html_url":"https://github.com/google/capsicum-test/issues/15","id":239890697,"number":15,"title":"Forked WithFiles.DisallowedFileSyscalls fails on FreeBSD 12 current","user":{"login":"svmhdvn","id":2187906,"avatar_url":"https://avatars2.githubusercontent.com/u/2187906?v=4","gravatar_id":"","url":"https://api.github.com/users/svmhdvn","html_url":"https://github.com/svmhdvn","followers_url":"https://api.github.com/users/svmhdvn/followers","following_url":"https://api.github.com/users/svmhdvn/following{/other_user}","gists_url":"https://api.github.com/users/svmhdvn/gists{/gist_id}","starred_url":"https://api.github.com/users/svmhdvn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svmhdvn/subscriptions","organizations_url":"https://api.github.com/users/svmhdvn/orgs","repos_url":"https://api.github.com/users/svmhdvn/repos","events_url":"https://api.github.com/users/svmhdvn/events{/privacy}","received_events_url":"https://api.github.com/users/svmhdvn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-06-30T21:16:28Z","updated_at":"2017-10-13T14:49:27Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The following assertion fails with `EINVAL`:\r\n```c\r\nEXPECT_CAPMODE(mknod(TmpFile(\"capmode_mknod\"), 0644, 0));\r\n```\r\nThis fails with `EINVAL` because capability mode validation occurs after a few checks on `mode` and `dev`. It might not be a useful test on FreeBSD for this reason. Furthermore, if we changed the arguments to reflect the creation of an actual special file (e.g. a character device), we would require root access to run the test.\r\n\r\nRelevant `mknod` functionality in FreeBSD 12 current from `sys/kern/vfs_syscalls.c`:\r\n```c\r\nint\r\nkern_mknodat(struct thread *td, int fd, char *path, enum uio_seg pathseg,\r\n    int mode, dev_t dev)\r\n{\r\n\tstruct vnode *vp;\r\n\tstruct mount *mp;\r\n\tstruct vattr vattr;\r\n\tstruct nameidata nd;\r\n\tcap_rights_t rights;\r\n\tint error, whiteout = 0;\r\n\r\n\tAUDIT_ARG_MODE(mode);\r\n\tAUDIT_ARG_DEV(dev);\r\n\tswitch (mode & S_IFMT) {\r\n\tcase S_IFCHR:\r\n\tcase S_IFBLK:\r\n\t\terror = priv_check(td, PRIV_VFS_MKNOD_DEV);\r\n\t\tif (error == 0 && dev == VNOVAL)\r\n\t\t\terror = EINVAL;\r\n\t\tbreak;\r\n\tcase S_IFMT:\r\n\t\terror = priv_check(td, PRIV_VFS_MKNOD_BAD);\r\n\t\tbreak;\r\n\tcase S_IFWHT:\r\n\t\terror = priv_check(td, PRIV_VFS_MKNOD_WHT);\r\n\t\tbreak;\r\n\tcase S_IFIFO:\r\n\t\tif (dev == 0)\r\n\t\t\treturn (kern_mkfifoat(td, fd, path, pathseg, mode));\r\n\t\t/* FALLTHROUGH */\r\n\tdefault:\r\n\t\terror = EINVAL;\r\n\t\tbreak;\r\n\t}\r\n\tif (error != 0)\r\n\t\treturn (error);\r\nrestart:\r\n\tbwillwrite();\r\n\tNDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |\r\n\t    NOCACHE, pathseg, path, fd, cap_rights_init(&rights, CAP_MKNODAT),\r\n\t    td);\r\n\tif ((error = namei(&nd)) != 0)\r\n\t\treturn (error);"},"comment":{"url":"https://api.github.com/repos/google/capsicum-test/issues/comments/336474982","html_url":"https://github.com/google/capsicum-test/issues/15#issuecomment-336474982","issue_url":"https://api.github.com/repos/google/capsicum-test/issues/15","id":336474982,"user":{"login":"emaste","id":1034582,"avatar_url":"https://avatars2.githubusercontent.com/u/1034582?v=4","gravatar_id":"","url":"https://api.github.com/users/emaste","html_url":"https://github.com/emaste","followers_url":"https://api.github.com/users/emaste/followers","following_url":"https://api.github.com/users/emaste/following{/other_user}","gists_url":"https://api.github.com/users/emaste/gists{/gist_id}","starred_url":"https://api.github.com/users/emaste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emaste/subscriptions","organizations_url":"https://api.github.com/users/emaste/orgs","repos_url":"https://api.github.com/users/emaste/repos","events_url":"https://api.github.com/users/emaste/events{/privacy}","received_events_url":"https://api.github.com/users/emaste/received_events","type":"User","site_admin":false},"created_at":"2017-10-13T14:49:27Z","updated_at":"2017-10-13T14:49:27Z","author_association":"CONTRIBUTOR","body":"It's a \"whiteout\" - it forces a negative lookup result (e.g. when using union or other layered filesystems). Google turned up a patch posted to lkml but I don't know if it went in: http://lkml.iu.edu/hypermail/linux/kernel/0704.2/0502.html\r\n\r\nI suggested it only because it has a known and unique value (I don't know what major/minor would be sensible to use if we wanted to actually create a character device)."}}
{"actor":{"display_login":"emaste"}}