On 10/26/2012 03:51 PM, Matt Fleming wrote:
From: Jeremy Kerr<[email protected]>

A write to an efivarfs file will not always result in a variable of
'count' size after the EFI SetVariable() call. We may have appended to
the existing data (ie, with the EFI_VARIABLE_APPEND_WRITE attribute), or
even have deleted the variable (with an authenticated variable update,
with a zero datasize).

This change re-reads the updated variable from firmware, to check for
size changes and deletions. In the latter case, we need to drop the
dentry.

File lingers after deletion with efivarfs_write_file.

Reproduced on QEMU/OVMF, 3.8-rc vanilla kernel.

Choosing the variable RTC because it's been generated by OVMF when
mounting.

Steps to reproduce (bash commandline):
# P=/sys/firmware/efi/efivars
# VAR=$P/RTC-378d7b65-8da9-4773-b6e4-a47826a833e1
# mount -t efivarfs - $P
# stat -c'%s %h' $VAR
8 1
# dd if=/dev/zero of=$VAR bs=4 count=1 conv=notrunc 2>&-
# stat -c'%s %h' $VAR
8 0

Writing four null bytes to $VAR should delete it.

--
Lingzhu Xiang
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to