Re: IMA: kernel reading files opened with O_DIRECT

Dmitry Kasatkin
2014-07-02T19:07:42Z

On 2 July 2014 21:45, Jeff Moyer <jmoyer@redhat.com> wrote:
> Christoph Hellwig <hch@infradead.org> writes:
>
>> On Wed, Jul 02, 2014 at 11:55:41AM -0400, Jeff Moyer wrote:
>>> It's acceptable.
>>
>> It's not because it will then also affect other reads going on at the
>> same time.
>

> OK, that part I was fuzzy on. I wasn't sure if they were preventing
> other reads/writes to the same file somehow. I should have mentioned
> that.
>
> Cheers,
> Jeff

What Christoph says is not very correct.

At open there cannot be any reads going on at the same time. IMA
reading is guarded by mutex. Following opens do not perform any IMA
readings and do not do what he says...

If file was modified with direct-io, VFS code itself always invalidate
pages before and after any write. It is basically what Christoph says.
But that is not IMA problem but direct-io itself. As it is stupid
interface. I would be more looking to kind of fadvise interface to
control amount of page caching...

So I think what Jeff suggest suites well to IMA.

--
Thanks,
Dmitry