On Wed, 2005-09-28 at 18:21 +0300, Kostik Belousov wrote:
> Hello,
>
> it seems that readv(2)/writev(2) syscalls do not call
> file_permission callback. Looks like this is overlook.
>
> I have filled the issue into redhat bugzilla as
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=169433
> and got the recommendation to post this on lsm mailing list.
>
> The following trivial patch solves the problem.
>
> --- linux-2.6.12/fs/read_write.c 2005-09-28 16:18:29.000000000 +0300
> +++ p/fs/read_write.c 2005-09-28 17:17:08.000000000 +0300
> @@ -485,6 +485,9 @@
> ret = rw_verify_area(type, file, pos, tot_len);
> if (ret)
> goto out;
> + ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE);
> + if (ret)
> + goto out;
>
> fnv = NULL;
> if (type == READ) {
I looked at the history of the tree, and the original LSM patch that was
upstreamed did include file_permission hook calls on the readv/writev
code paths, but they were later blitzed during a rewrite of the
readv/writev code paths in the mainline kernel circa 2.5.47, and never
revived. As these hooks are only for revalidation/revocation of access,
their absence would only manifest if access was initially granted during
open but later revoked by a relabel or policy change.
--
Stephen Smalley
National Security Agency
This archive was generated by hypermail 2.1.3 : Thu Sep 29 2005 - 06:19:32 PDT