| From: | Stephen Smalley <sds-AT-tycho.nsa.gov> | |
| To: | Kostik Belousov <kostikbel-AT-gmail.com> | |
| Subject: | Re: readv/writev syscalls are not checked by lsm | |
| Date: | Thu, 29 Sep 2005 09:15:48 -0400 | |
| Cc: | chrisw-AT-osdl.org, linux-security-module-AT-wirex.com | |
| Archive-link: | Article, Thread |
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
Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds