Re: [PATCH 1/2] fs/efivarfs: restrict inode permissions

From: Matthew Garrett
Date: Tue Feb 20 2018 - 18:39:51 EST


On Tue, Feb 20, 2018 at 3:30 PM Luck, Tony <tony.luck@xxxxxxxxx> wrote:
> [1] I didn't dig through the Linux code to check whether we manage to
> get those four SMIs from a single EFI call, or whether we make multiple
> EFI calls to open/read/close one file. It is possible that we stink a
> bit too if we are doing more EFI calls than required.

read() will make two calls - one to obtain the size of the variable, the
other to read it. It looks like cat will also trigger an fstat(), so we're
probably also making a call for that. There's presumably some optimisation
that could be made there if we trust the firmware not to change the size
behind our back.