2009-05-11 20:09:12

by Eric Paris

[permalink] [raw]
Subject: Re: integrity: nfsd imbalance bug fix

On Fri, May 8, 2009 at 1:35 PM, Mimi Zohar <[email protected]> w=
rote:
> On Wed, 2009-04-29 at 14:18 -0700, Andrew Morton wrote:
>> On Tue, 28 Apr 2009 14:32:14 -0400
>> Mimi Zohar <[email protected]> wrote:

>> > Index: security-testing-2.6/mm/shmem.c
>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> > --- security-testing-2.6.orig/mm/shmem.c
>> > +++ security-testing-2.6/mm/shmem.c
>> > @@ -2680,7 +2680,7 @@ int shmem_zero_setup(struct vm_area_stru
>> > =A0 =A0 if (IS_ERR(file))
>> > =A0 =A0 =A0 =A0 =A0 =A0 return PTR_ERR(file);
>> >
>> > - =A0 ima_shm_check(file);
>> > + =A0 ima_opencount_get(file);
>> > =A0 =A0 if (vma->vm_file)
>> > =A0 =A0 =A0 =A0 =A0 =A0 fput(vma->vm_file);
>> > =A0 =A0 vma->vm_file =3D file;
>>
>> Maybe do the IMA operations in (or under) shmem_file_setup() and
>> hugetlb_file_setup()?
>
> Again, that would hide the real issue of not having done integrity
> (permission) checking.

Where are we doing integrity or permission checks on hugetlb or shm
files? Andrew's right, another example of this problem would be
drivers/gpu/drm/drm_gem.c::drm_get_object_alloc() (at least in
linux-next) which uses shmem_file_setup(). If we aren't doing
integrity checks on shmem already, why do we care about kernel vs.
non-kernel users?

moving the ima_opencount_get() from newseg down a layer into
*_file_setup() would, I think, have taken care of the drm case as
well.....

-Eric