linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Couple of efivarfs fixes
@ 2020-05-28 19:49 Tony Luck
  2020-05-28 19:49 ` [PATCH 1/2] efivarfs: Update inode modification time for successful writes Tony Luck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tony Luck @ 2020-05-28 19:49 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Tony Luck, Matthew Garrett, Jeremy Kerr, linux-efi, linux-kernel

1) Some apps want to monitor changes in EFI variables, but reading the
   file and comparing is inefficient.  Just have Linnux update the
   modification time when a file is written

2) A rate limited read can return -EINTR ... very suprising to apps.

Tony Luck (2):
  efivarfs: Update inode modification time for successful writes
  efivarfs: Don't return -EINTR when rate-limiting reads

 fs/efivarfs/file.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.21.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] efivarfs: Update inode modification time for successful writes
  2020-05-28 19:49 [PATCH 0/2] Couple of efivarfs fixes Tony Luck
@ 2020-05-28 19:49 ` Tony Luck
  2020-05-28 19:49 ` [PATCH 2/2] efivarfs: Don't return -EINTR when rate-limiting reads Tony Luck
  2020-06-15  9:50 ` [PATCH 0/2] Couple of efivarfs fixes Ard Biesheuvel
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Luck @ 2020-05-28 19:49 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Tony Luck, Lennart Poettering, Matthew Garrett, Jeremy Kerr,
	linux-efi, linux-kernel

Some applications want to be able to see when EFI variables
have been updated.

Update the modification time for successful writes.

Reported-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 fs/efivarfs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c
index e9e27a271af0..4b8bc4560d70 100644
--- a/fs/efivarfs/file.c
+++ b/fs/efivarfs/file.c
@@ -51,6 +51,7 @@ static ssize_t efivarfs_file_write(struct file *file,
 	} else {
 		inode_lock(inode);
 		i_size_write(inode, datasize + sizeof(attributes));
+		inode->i_mtime = current_time(inode);
 		inode_unlock(inode);
 	}
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] efivarfs: Don't return -EINTR when rate-limiting reads
  2020-05-28 19:49 [PATCH 0/2] Couple of efivarfs fixes Tony Luck
  2020-05-28 19:49 ` [PATCH 1/2] efivarfs: Update inode modification time for successful writes Tony Luck
@ 2020-05-28 19:49 ` Tony Luck
  2020-06-15  9:50 ` [PATCH 0/2] Couple of efivarfs fixes Ard Biesheuvel
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Luck @ 2020-05-28 19:49 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Tony Luck, Lennart Poettering, Matthew Garrett, Jeremy Kerr,
	linux-efi, linux-kernel

Applications that read EFI variables may see a return
value of -EINTR if they exceed the rate limit and a
signal delivery is attempted while the process is sleeping.

This is quite surprising to the application, which probably
doesn't have code to handle it.

Change the interruptible sleep to a non-interruptible one.

Reported-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 fs/efivarfs/file.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c
index 4b8bc4560d70..feaa5e182b7b 100644
--- a/fs/efivarfs/file.c
+++ b/fs/efivarfs/file.c
@@ -73,10 +73,8 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
 	ssize_t size = 0;
 	int err;
 
-	while (!__ratelimit(&file->f_cred->user->ratelimit)) {
-		if (!msleep_interruptible(50))
-			return -EINTR;
-	}
+	while (!__ratelimit(&file->f_cred->user->ratelimit))
+		msleep(50);
 
 	err = efivar_entry_size(var, &datasize);
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Couple of efivarfs fixes
  2020-05-28 19:49 [PATCH 0/2] Couple of efivarfs fixes Tony Luck
  2020-05-28 19:49 ` [PATCH 1/2] efivarfs: Update inode modification time for successful writes Tony Luck
  2020-05-28 19:49 ` [PATCH 2/2] efivarfs: Don't return -EINTR when rate-limiting reads Tony Luck
@ 2020-06-15  9:50 ` Ard Biesheuvel
  2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2020-06-15  9:50 UTC (permalink / raw)
  To: Tony Luck
  Cc: Matthew Garrett, Jeremy Kerr, linux-efi,
	Linux Kernel Mailing List

On Thu, 28 May 2020 at 21:49, Tony Luck <tony.luck@intel.com> wrote:
>
> 1) Some apps want to monitor changes in EFI variables, but reading the
>    file and comparing is inefficient.  Just have Linnux update the
>    modification time when a file is written
>
> 2) A rate limited read can return -EINTR ... very suprising to apps.
>
> Tony Luck (2):
>   efivarfs: Update inode modification time for successful writes
>   efivarfs: Don't return -EINTR when rate-limiting reads
>
>  fs/efivarfs/file.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>

Queued in efi/urgent

Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-15  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-28 19:49 [PATCH 0/2] Couple of efivarfs fixes Tony Luck
2020-05-28 19:49 ` [PATCH 1/2] efivarfs: Update inode modification time for successful writes Tony Luck
2020-05-28 19:49 ` [PATCH 2/2] efivarfs: Don't return -EINTR when rate-limiting reads Tony Luck
2020-06-15  9:50 ` [PATCH 0/2] Couple of efivarfs fixes Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).