OSDN Git Service
Peter Jones [Wed, 6 Jun 2018 20:53:37 +0000 (16:53 -0400)]
Move the PMEM device parser to linux-pmem.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:51:08 +0000 (16:51 -0400)]
Add a PCI parser that's independent of the other stuff.
This doesn't actually remove the old one, but a later patch will when
it's replacing all that stuff.
This won't actually *work* yet, either, because the infrastructure to
use it (replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:47:11 +0000 (16:47 -0400)]
Move SAS parsing to linux-sas.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:45:21 +0000 (16:45 -0400)]
Move SATA parsing to linux-sata.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:43:30 +0000 (16:43 -0400)]
Move nvme parsing to linux-nvme.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:41:50 +0000 (16:41 -0400)]
Move virtblk device parsing to linux-virtblk.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:40:05 +0000 (16:40 -0400)]
Move i2o device parsing to linux-i2o.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:37:46 +0000 (16:37 -0400)]
Move traditional SCSI parsing to linux-scsi.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:32:26 +0000 (16:32 -0400)]
Move ATA parsing to linux-ata.c
This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 7 Jun 2018 17:07:55 +0000 (13:07 -0400)]
Add a (not great) macro to print parser debugging arrows.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:15:35 +0000 (16:15 -0400)]
Add "struct device" in preperation for removing "struct disk_info".
Also adds src/linux-*.c to the makefile
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:55:58 +0000 (16:55 -0400)]
efi_loadopt_create(): add some debugging
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 30 May 2018 20:59:46 +0000 (16:59 -0400)]
ucs2.h: there's no reason ucs2_to_utf8 shouldn't malloc directly.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 22 May 2018 14:04:52 +0000 (10:04 -0400)]
rename the pci_root_info fields to match the struct name
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 22 May 2018 13:57:25 +0000 (09:57 -0400)]
Move get_sector_size() to the linux specific code
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 22 May 2018 13:55:05 +0000 (09:55 -0400)]
linux.h: add some more sysfs helpers, and improve their error handling.
... this also moves them from util.h
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 21 May 2018 19:53:30 +0000 (15:53 -0400)]
More fixups for CONSTRUCTOR/DESTRUCTOR/HIDDEN/PUBLIC/etc.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 21 May 2018 18:23:52 +0000 (14:23 -0400)]
Add some helpers for file path mangling
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 21 May 2018 15:18:00 +0000 (11:18 -0400)]
util.h: Add error reporting in read_file()
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 6 Jun 2018 20:30:08 +0000 (16:30 -0400)]
Temporary hack in get_partition_number
This code has been wrong for a while, but it's getting removed, so
really don't bother *fixing* it so much as appeasing newer gcc's
noticing that it's uninitialized.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 21 May 2018 13:40:01 +0000 (09:40 -0400)]
Make LIBEFIVAR_OPS=help work
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 26 Apr 2018 19:57:48 +0000 (15:57 -0400)]
Add some more debug facilities.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 26 Apr 2018 19:05:38 +0000 (15:05 -0400)]
Add hexdumper
Peter Jones [Mon, 21 May 2018 14:08:55 +0000 (10:08 -0400)]
Make all of our Make.* files have vim:ft=make
... except Make.version because it's fully automated.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 21 May 2018 13:53:15 +0000 (09:53 -0400)]
fix some dumb stuff in 'make install' targets
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Fri, 18 May 2018 17:23:01 +0000 (13:23 -0400)]
gpt.h: minor cleanups (mostly formatting/whitespace)
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 18 Apr 2018 21:47:26 +0000 (17:47 -0400)]
get_partition_info(): fix the return code error path.
Half the code thinks >= 0 is success, half the code things <= 0 is
success...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 21:57:10 +0000 (17:57 -0400)]
clang: ?e64_to_cpu() and cpu_to_?e64(): cast to uint64_t.
On x86_64, clang makes __builtin_bswap64() return "unsigned long"
instead of "unsigned long long", so using PRIx64 complains all over the
place. Casting to uint64_t satisfies both compilers.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 20:37:57 +0000 (16:37 -0400)]
More aggressively use macros for compiler attributes
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 20:31:59 +0000 (16:31 -0400)]
Simplify our include files
Make everything just include src/efivar.h or src/efiboot.h, and let
those sort out the correct things to include.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 19 Apr 2018 14:25:16 +0000 (10:25 -0400)]
util.h: whitespace cleanup
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 18 Apr 2018 21:46:45 +0000 (17:46 -0400)]
gpt: get rid of ad-hoc warning reporting; use efi_error()
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 20:34:49 +0000 (16:34 -0400)]
gpt: don't use the __ versions of cpu_to_le??()/le??_to_cpu()
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 19:10:40 +0000 (15:10 -0400)]
efivar: fix efi_well_known_guids and efi_well_known_guids_end definitions
From github:
build command: make CROSS_COMPILE=aarch64-linux-gnu- prefix=/home/b58867/Desktop/ls1043ardb/efivar/efivar_arm64 static
compilation error:
aarch64-linux-gnu-gcc -O2 -flto -g3 -I/home/b58867/Desktop/ls1043ardb/efivar/src/include/ -specs=/home/b58867/Desktop/ls1043ardb/efivar/gcc.specs -L. -Wl,-z,muldefs -static -o efivar-static efivar.c dp.static.o dp-acpi.static.o dp-hw.static.o dp-media.static.o dp-message.static.o efivarfs.static.o error.static.o export.static.o guid.static.o guids.static.o guid-symbols.static.o lib.static.o vars.static.o -ldl
guid.c:112:24: error: type of ‘efi_well_known_guids_end’ does not match original declaration [-Werror]
extern struct guidname efi_well_known_guids_end
^
efivar.c:490:28: note: previously declared here
extern struct guidname *efi_well_known_guids_end;
^
efivar.c:489:27: error: type of ‘efi_well_known_guids’ does not match original declaration [-Werror]
extern struct guidname efi_well_known_guids[];
^
guid.c:108:24: note: previously declared here
extern struct guidname efi_well_known_guids
^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: aarch64-linux-gnu-gcc returned 1 exit status
Fixes github issue #102
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 18 Apr 2018 21:44:22 +0000 (17:44 -0400)]
Fix our pkg-config-ldflags invocation.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 9 May 2018 20:14:52 +0000 (16:14 -0400)]
We don't use list.h at all; axe it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 17 May 2018 15:44:25 +0000 (11:44 -0400)]
Another minor docs typo fix.
Signed-off-by: Peter Jones <pjones@redhat.com>
Robert Bisewski [Sun, 29 Apr 2018 19:08:45 +0000 (14:08 -0500)]
minor correction to the efi_variable_import and efi_variable_export man-page
Laszlo Ersek [Wed, 16 May 2018 17:21:27 +0000 (19:21 +0200)]
rewrite efivarfs_set_variable() [
9896c26c7e68-based]
This patch rewrites the efivarfs_set_variable() function, to address the
following issues:
- a size_t value is printed with %zd -- size_t is unsigned, so it should
be printed with %zu or %zx,
- a VLA is used for storing input of basically unbounded size -- we should
use a range-checked malloc() call instead,
- the efivarfs file is opened for writing while it may be immutable --
this is the trickiest issue to resolve,
- passing just O_APPEND|O_CREAT to open() is undefined -- O_WRONLY is
required, and O_APPEND and (O_CREAT | O_EXCL) should both be independent
of it (and of each other),
- some error branches call efi_error() without setting errno first,
- the variable is removed on any write failure, even if we didn't create
the variable -- failed writes are expected to be atomic (from the kernel
side and from the firmware side) and not to leave behind side effects;
so only delete the variable on error if we created it.
A small helper function efivarfs_make_fd_mutable() is introduced as well.
(It's best to review the new efivarfs_set_variable() function in its
entirety, with the patch applied, rather than comparing old vs. new, hunk
for hunk.)
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=
1516599
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Peter Jones [Tue, 17 Apr 2018 17:49:19 +0000 (13:49 -0400)]
Silence some trivial clang-analyzer/coverity complaints.
One minor memory leak in /usr/bin/efivar, a couple of places where the
analyzers make assumptions without being able to figure out the data
flow.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 17 Apr 2018 17:44:58 +0000 (13:44 -0400)]
dp-acpi: improve formatting of AcpiEx() device paths.
This also fixes a minor scan-build complaint about cidlen being assigned
but not used.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 17 Apr 2018 17:26:45 +0000 (13:26 -0400)]
Add a clang-analyzer scan-build make targets as well.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 17 Apr 2018 16:28:24 +0000 (12:28 -0400)]
Work around coverity being a pretty lazy and poor tool.
I mean, come on, at least dynamically import the types you've missed
from the version of GCC that's installed on the system and you're
pretending to emulate.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 11 Apr 2018 20:46:23 +0000 (16:46 -0400)]
Update travis to use some better build scripts
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 9 Apr 2018 19:33:44 +0000 (15:33 -0400)]
Simplify the docker/travis stuff some
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 9 Apr 2018 19:04:13 +0000 (15:04 -0400)]
try to make travis work again...
Peter Jones [Mon, 9 Apr 2018 18:52:25 +0000 (14:52 -0400)]
Bump version to 35
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Mar 2017 17:36:55 +0000 (13:36 -0400)]
Don't use _Generic because gcc 4.x doesn't have it...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 19 Mar 2018 16:41:07 +0000 (12:41 -0400)]
Make efi_get_variable_exists match the version we put on it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 23:25:25 +0000 (19:25 -0400)]
Make non-pull-request builds work.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 23:07:52 +0000 (19:07 -0400)]
Use https for github urls in travis.
If I don't, I awesomely get:
git remote add remote git@github.com:${remote_repo}
git fetch remote
Host key verification failed.
fatal: Could not read from remote repository.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 22:38:48 +0000 (18:38 -0400)]
more travis stuf...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 22:36:26 +0000 (18:36 -0400)]
More travis stuff maybe.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 22:11:45 +0000 (18:11 -0400)]
Make the log smaller...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 22:08:16 +0000 (18:08 -0400)]
Some more travis work...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 21:59:28 +0000 (17:59 -0400)]
Make travis dump some stuff at us.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 21:10:56 +0000 (17:10 -0400)]
Work around -Werror=stringop-overflow= being daft.
With:
len = strlen(foo + offset) + 1;
buf = calloc(1, len);
if (!buf)
err(1, "out of memory");
strncpy(buf, foo+offset, len);
-Wstringop-overflow complains:
efivar.c:169:2: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
strncpy(name_buf, guid_name + name_pos, name_len);
^
efivar.c:163:13: note: length computed here
name_len = strlen(guid_name + name_pos) + 1;
^
lto1: all warnings being treated as errors
Which... Duh, so was the allocation it's writing into. So what?
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 21:10:49 +0000 (17:10 -0400)]
Update travis.yml to be wildly different...
Peter Jones [Tue, 13 Mar 2018 14:31:00 +0000 (10:31 -0400)]
Make
0abba7dc-e516-4167-bbf5-
4d9d1c739416 reflect its use in fwupdate
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Mar 2018 15:07:15 +0000 (11:07 -0400)]
makeguids: generalize the efi_guid_empty mechanism to arbitrary aliases.
Signed-off-by: Peter Jones <pjones@redhat.com>
Richard Hughes [Fri, 9 Mar 2018 11:21:03 +0000 (11:21 +0000)]
Add efi_get_variable_exists()
Sometimes we just want to know if a variable exists, and don't care about the
attributes or what the variable contains. Use efi_get_variable_attributes()
under the covers to avoid adding yet-another-fvunc to all the backends.
Peter Jones [Mon, 12 Mar 2018 14:38:44 +0000 (10:38 -0400)]
Use __builtin_bswap16() in EFI_GUID and other places.
This makes EFI_GUID() usually not be an expression that has to be in a
function.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Fri, 23 Feb 2018 20:49:02 +0000 (15:49 -0500)]
efivarfs / vars: usleep() before reading from efivarfs if euid != 0
There's a kernel rate limiter on efi variable reads now for
non-root users, and we'd rather just not hit it than have to dig out
from having hit it. So this adds a 10ms sleep before each read call.
If you do have 50 variables, efibootmgr will do 100 reads, which would
trigger the rate limit. In that case, this patch adds 1 second (plus
lossage due to calling, etc.), so it should stay just below the
triggering threshold. That will definitely be /smoother/ than hitting
it, and almost certainly faster as well, because the extra calls will
re-enforce the limit.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Feb 2018 16:21:21 +0000 (11:21 -0500)]
Bump version to 34
Signed-off-by: Peter Jones <pjones@redhat.com>
Mario Limonciello [Thu, 11 Jan 2018 21:18:05 +0000 (15:18 -0600)]
Add UX capsule to map for 33 not 32
commit
cd732494 fixed UX capsule support, but it mistakingly marked
it for version 32. It really should be marked for 33.
Mario Limonciello [Mon, 8 Jan 2018 23:12:30 +0000 (17:12 -0600)]
Add a patch from Helmut Grohne for cross compiling
Originally came from
https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=843261;filename=efivar_30-1.1.debdiff;msg=5
Jan Tojnar [Sun, 17 Dec 2017 07:54:50 +0000 (08:54 +0100)]
Clean up superfluous slashes
Jan Tojnar [Sun, 17 Dec 2017 07:41:00 +0000 (08:41 +0100)]
Use correct paths in pc files
Previously, the paths in the pkgconfig files were hardcoded resulting
in broken include paths on NixOS.
This patch replaces the paths with placeholders that will be changed
during making.
Peter Jones [Fri, 9 Feb 2018 16:16:47 +0000 (11:16 -0500)]
Be more stringent on the criteria for not doing disk probes.
This bit of the nvdimm code stops HD() paths from getting generated
right sometimes.
Signed-off-by: Peter Jones <pjones@redhat.com>
Dan Robertson [Wed, 7 Feb 2018 13:01:44 +0000 (13:01 +0000)]
define strndupa if it is not defined
musl does not include strndupa in <string.h>. Define strndupa if it has
not already been defined.
Dan Robertson [Wed, 7 Feb 2018 13:00:09 +0000 (13:00 +0000)]
cleanup: found is always true in branch
Remove use of found in conditional, as it is always true.
Peter Jones [Tue, 23 Jan 2018 16:12:56 +0000 (11:12 -0500)]
Bump version to 33
- Add NVDIMM support.
- Doesn't change much, but we need to bump to 33 because of an fwupdate bug.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 23 Jan 2018 16:07:19 +0000 (11:07 -0500)]
lib*.abixml: update to avoid the "added-function" issue.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 23 Jan 2018 16:05:06 +0000 (11:05 -0500)]
abignore: minor regexp fixes.
These don't help, mind you, as currently "added-function" exceptions
don't seem to work at all, and they're impossible to debug.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 16 Jan 2018 21:04:58 +0000 (16:04 -0500)]
Fix some broken .abixml files
Apparently whichever version of libabigail I built with left the first
argument out of several function definitions in the .abixml file. This
fixes them up while avoiding the other major changes (i.e.
efidp_make_nvdimm should still be "new", even though that change should
still be suppressed when we compare them.)
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 16 Jan 2018 19:34:23 +0000 (14:34 -0500)]
NVDIMM: UUID<->GUID needs endian swizzling.
The NVDIMM Label in sysfs is a UUID rather than a GUID. The big
difference is UUIDs are stored opposite-endian from GUIDs, so
efi_str_to_guid() is giving us back a GUID with the first 8 bytes in the
wrong order. Fix it up after we read it from sysfs and parse it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 7 Dec 2017 16:37:41 +0000 (11:37 -0500)]
More NVDIMM work.
With this, it works with efibootmgr:
[root@testbox pjones]# LD_LIBRARY_PATH=/root/pjones efibootmgr -b 000E -C -d /dev/pmem12.2 -L pjones-test -l /dax-screw-aeI12d -v
BootCurrent: 000D
Timeout: 1 seconds
BootOrder: 000D
Boot000D* Red Hat Enterprise Linux HD(1,GPT,
727bbaeb-9766-4e3b-b374-
d3f2dc9a0ab5,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)
Boot000E* pjones-test NVDIMM(
829c5205-89a5-4581-9819-
df7d7754c622)/File(\dax-screw-aeI12d)
(obviously this won't actually boot because /mnt/test is not the ESP and
dax-screw-aeI12d is just some random file I found sitting around, but
the EFI boot variable appears to be correct.)
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 4 Dec 2017 22:46:13 +0000 (17:46 -0500)]
makeguids: use builtins for bswap() functions.
A. Wilcox [Sat, 19 Aug 2017 01:36:03 +0000 (20:36 -0500)]
makeguids: Ensure compatibility with other libcs
The musl libc does not provide __bswap_constant_XX.
If <endian.h> does not provide these macros, use our own.
This fixes issue #84.
Peter Jones [Mon, 4 Dec 2017 22:27:57 +0000 (17:27 -0500)]
Add NVDIMM-P support
Peter Jones [Mon, 4 Dec 2017 22:24:46 +0000 (17:24 -0500)]
better error reports in linux and creator code
Peter Jones [Mon, 4 Dec 2017 22:23:17 +0000 (17:23 -0500)]
Peter Jones [Mon, 4 Dec 2017 20:02:26 +0000 (15:02 -0500)]
add protocol guids list
Peter Jones [Mon, 4 Dec 2017 15:47:12 +0000 (10:47 -0500)]
Add the external management mechanism guid
Peter Jones [Tue, 26 Sep 2017 18:05:02 +0000 (14:05 -0400)]
efivarfs_set_variable(): don't test access before creating variables.
Coverity, possibly correctly (though it's hard to see what the resulting
problem would be in this case), believes checking access(path, F_OK)
before doing open(path, ...) is a TOCTOU error. And it arguably is,
except you have to be root to do this and we're operating entirely in
sysfs, so... hard to see how you could race it or what you could gain.
Maybe something at a higher level can be convinced to race stupidly if
you're calling libefivar. I dunno.
Anyway, attempt to fix it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 26 Sep 2017 17:42:16 +0000 (13:42 -0400)]
Work around coverity being stupid (CID 182336/REVERSE_INULL)
Coverity *really* doesn't like testing a string that's been previously
dereferenced, because they believe programs are written once and nothing
ever changes, and they don't believe common error paths should plan for
that to happen.
Thus, if you do:
int
foo(void)
{
int ret = -1, rc;
char *path = NULL;
rc = asprintf(&path, "foo");
if (rc < 0)
return -1; // because this is return, not goto err ...
// lots of stuff ...
if (rc < 0)
goto err; // ... and this is goto err ...
// stuff ...
ret = 0;
err:
if (path) // ... CID 182336 (REVERSE_INULL) triggers here
free(path);
return ret;
}
Even though this is perfectly reasonable code that does not contain any
actual bugs, coverity's REVERSE_INULL check complains about the test on
path. This isn't a complaint about the code - it's an error message
about coverity's inability to infer why you've done it. And why you've
done it is so that if the code above changes, the error path doesn't
suddenly become unsafe.
So change the error path usage so that it will also jump to the common
error path, which is completely unnecessary, when path could be NULL.
Yes, this is stupid.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 26 Sep 2017 17:37:59 +0000 (13:37 -0400)]
efivar: prepare_data(): check for invalid filename.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 26 Sep 2017 17:21:59 +0000 (13:21 -0400)]
Make a checker for coverity being installed
Signed-off-by: Peter Jones <pjones@redhat.com>
David Cantrell [Fri, 22 Sep 2017 16:51:55 +0000 (12:51 -0400)]
Remove popt-devel from BuildRequires in the spec file.
Signed-off-by: David Cantrell <david.l.cantrell@gmail.com>
David Cantrell [Fri, 22 Sep 2017 16:52:31 +0000 (12:52 -0400)]
Remove PKGS=popt from src/Makefile
Signed-off-by: David Cantrell <david.l.cantrell@gmail.com>
David Cantrell [Tue, 26 Sep 2017 13:50:50 +0000 (09:50 -0400)]
Replace popt usage with getopt_long in efivar.c.
efivar does not make use of popt in a way that really requires the
dependency. Since this is a low level system utility, it's possible
some system builders want to reduce redundant libraries they need to
build and install. popt is arguably redundant with getopt_long. It's
possible to just drop long option handling entirely so it works with
plain old getopt. The intent with this patch was to provide the same
command line options but just using what the C library provides rather
than popt.
The attributes variable in main() has also been changed to a uint32_t
size and sign consistency with its usage in edit_variable().
Signed-off-by: David Cantrell <david.l.cantrell@gmail.com>
rtlanceroad [Wed, 13 Sep 2017 10:10:33 +0000 (18:10 +0800)]
test: Fix efivar.h location
When other bits of the source got fixed to use a different include path
for efivars, the test directory did not.
Peter Jones [Tue, 26 Sep 2017 17:01:13 +0000 (13:01 -0400)]
Revert "Enable C11 mode" (
d7e8e4c6) and do it the right way.
This reverts commit
d7e8e4c646ff02ec7e308998de5f2318d6607dbc.
We already have -std=gnu11 in gcc.specs, we just need it on the clang
side as well, so put it there.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Feb 2017 22:16:28 +0000 (17:16 -0500)]
Make pkg-config test if CROSS_COMPILE applies...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Feb 2017 21:48:31 +0000 (16:48 -0500)]
Make.defaults: honor COMPILER to make CI easier.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Fri, 10 Feb 2017 22:10:50 +0000 (17:10 -0500)]
add some travis CI bits here to see if it works
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 25 Sep 2017 18:50:38 +0000 (14:50 -0400)]
make: improve 'clean' target
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 25 Sep 2017 16:20:04 +0000 (12:20 -0400)]
Make format_ucs2() not use a variable-length array.
Coverity complains (during the build, as a "recoverable" error):
"dp.h", line 134: warning #1234: a variable-length array is not allowed inside
of a statement expression
uint16_t _ucs2buf[(len)]; \
^
So don't do that.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 25 Sep 2017 16:08:09 +0000 (12:08 -0400)]
Use fwupdate's Make.coverity instead of implementing it inline.
Signed-off-by: Peter Jones <pjones@redhat.com>
Gabriel Majeri [Sun, 24 Sep 2017 12:20:51 +0000 (15:20 +0300)]
Enable C11 mode