Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/efivarfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ efivarfs_get_variable(efi_guid_t guid, const char *name, uint8_t **data,
int fd = -1;
char *path = NULL;
int rc;
int ratelimit;

/*
* The kernel rate limiter hits us if we go faster than 100 efi
* variable reads per second as non-root. So if we're not root, just
* delay this long after each read. The user is not going to notice.
*
* 1s / 100 = 10000us.
*/
ratelimit = geteuid() == 0 ? 0 : 10000;

rc = make_efivarfs_path(&path, guid, name);
if (rc < 0) {
Expand All @@ -269,14 +259,12 @@ efivarfs_get_variable(efi_guid_t guid, const char *name, uint8_t **data,
goto err;
}

usleep(ratelimit);
rc = read(fd, &ret_attributes, sizeof (ret_attributes));
if (rc < 0) {
efi_error("read failed");
goto err;
}

usleep(ratelimit);
rc = read_file(fd, &ret_data, &size);
if (rc < 0) {
efi_error("read_file failed");
Expand Down
11 changes: 0 additions & 11 deletions src/vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,6 @@ vars_get_variable(efi_guid_t guid, const char *name, uint8_t **data,
char *path = NULL;
int rc;
int fd = -1;
int ratelimit;

/*
* The kernel rate limiter hits us if we go faster than 100 efi
* variable reads per second as non-root. So if we're not root, just
* delay this long after each read. The user is not going to notice.
*
* 1s / 100 = 10000us.
*/
ratelimit = geteuid() == 0 ? 0 : 10000;

rc = asprintf(&path, "%s%s-" GUID_FORMAT "/raw_var", get_vars_path(),
name, GUID_FORMAT_ARGS(&guid));
Expand All @@ -314,7 +304,6 @@ vars_get_variable(efi_guid_t guid, const char *name, uint8_t **data,
goto err;
}

usleep(ratelimit);
rc = read_file(fd, &buf, &bufsize);
if (rc < 0) {
efi_error("read_file(%s) failed", path);
Expand Down