OSDN Git Service
Peter Jones [Mon, 1 May 2017 19:19:18 +0000 (15:19 -0400)]
efi_loadopt_args_from_file(): make sure buf is only NULL if size is.
This avoids passing NULL to fread().
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 19:18:05 +0000 (15:18 -0400)]
show_errors(): make the useful part here not be dead code.
Woops.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 19:14:33 +0000 (15:14 -0400)]
efidp_duplicate_extra(): error if our allocation is too small.
Covscan believes we might pass 0 to calloc(), though I suspect this is
because it doesn't fully grok add().
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 19:04:24 +0000 (15:04 -0400)]
efi_loadopt_create(): check buf for NULLness.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 19:02:27 +0000 (15:02 -0400)]
efi_variable_import(): constrain our inputs better.
efi_variable_import() could plausibly pass NULL to memcpy() if buf is 0
and size is < 0, though that should never be the case. Make the input
checking return EINVAL if that's the case.
Found by Covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:59:57 +0000 (14:59 -0400)]
makeguids: free our input buffer.
Covscan noticed this, but didn't notice that this is a short lived
program that just parses some tables during the build. It *sooo*
doesn't matter.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:56:53 +0000 (14:56 -0400)]
efi_variable_import(): make sure var.data_size is set.
Covscan noticed that var.data_size isn't set when we memcpy the
structure. It should be set.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:54:15 +0000 (14:54 -0400)]
efidp_append_path(): error check the right variable.
We do lsz=efidp_size(dp); rsz=efidp_size(dn); and then we error check
lsz twice. One should be rsz.
We also actually do the whole thing with lsz twice anyway, and fail to
check that dp isn't NULL first.
We're also not error checking that the buffer from our addition is
actually large enough to hold something meaningful. So do that too.
None of that is right, so fix it.
Covscan completely failed to notice this, but complained about something
irrelevant later on in the code that's a result.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:52:48 +0000 (14:52 -0400)]
efi_variable_import(): fix memory leak on failure path.
When one of our allocations fails, we leak the other one. Woops.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:48:49 +0000 (14:48 -0400)]
efi_va_generate_file_device_path_from_esp(): handle errors better.
When efi_va_generate_file_device_path_from_esp() gets an error from
efidp_make_edd10() or make_blockdev_path(), it fails to close the file
descriptor it uses to do ioctl() against the disk. So make it use the
common error path for those as well.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:46:37 +0000 (14:46 -0400)]
efi_generate_file_device_path(): fix one error case's free path.
When efi_generate_file_device_path() gets an error from
find_parent_devpath(), it currently just returns an error, rather than
freeing up its intermediate resources. So free them.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:44:43 +0000 (14:44 -0400)]
gpt_disk_get_partition_info(): free our allocations on the error path.
When gpt_disk_get_partition_info() discovers that a partition is
invalid, it returns error, but it forgets to free its allocations.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:42:25 +0000 (14:42 -0400)]
make_mac_path(): fix leaked file descriptor.
When make_mac_path() gets an error from efidp_make_mac_addr(), it fails
to close the file descriptor to the network device. So close it. Also
ensure that the ifrn_name field is NUL terminated.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 1 May 2017 18:40:26 +0000 (14:40 -0400)]
efi_loadopt_args_from_file(): fix leaked file descriptor.
In the case where we're just trying to figure out the file's size, we're
failing to close the file. So close it.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 7 Mar 2017 16:16:25 +0000 (11:16 -0500)]
Update .abixml files
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 19:52:58 +0000 (14:52 -0500)]
Bump version to 31
- Work around NVMe EUI sysfs change
- Provide some oldish version strings we should have kept.
- lots of overflow checking on our pointer math in dp parsing
- fix major/minor device number handling in the linux code
- Do better formatting checks for MBR partitions
- Fixes for gcc 7
Signed-off-by: Peter Jones <pjones@redhat.com>
Raymund Will [Tue, 21 Feb 2017 14:55:43 +0000 (15:55 +0100)]
libefivar: drop conditional include of sys/sysmacros.h
This reverts commit
c5685d8d as it has been obsoleted by commit
3ad5aab6.
Signed-off-by: Raymund Will <rw@suse.com>
Peter Jones [Tue, 14 Feb 2017 16:42:15 +0000 (11:42 -0500)]
Make 'make test-archive' do abicheck
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 1 Feb 2017 19:28:14 +0000 (14:28 -0500)]
Make ACPI _ADR encoding/decoding more useful.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Feb 2017 16:05:43 +0000 (11:05 -0500)]
Add an abicheck makefile rule
This adds an abicheck makefile rule, and puts it in the "make archive"
path.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Feb 2017 16:35:02 +0000 (11:35 -0500)]
Add some .abixml files
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 13 Feb 2017 16:05:25 +0000 (11:05 -0500)]
Make a target to update .abixml files.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 21:46:49 +0000 (16:46 -0500)]
Add the ABI tracker to the readme
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 21:27:54 +0000 (16:27 -0500)]
Don't build static by default.
Since lots of distros don't ship static libraries, it's better not to do
this by default. This also adds "make static" as a top-level build
target.
This fixes github issue #72.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 21:00:54 +0000 (16:00 -0500)]
Don't call mode optional in the man page any more.
Since it's such a pain to keep optional mode working and we've taken out
the API declaration that makes it possible to use in new code, take it
out of the docs as well.
This fixes github issue #73
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 20:43:51 +0000 (15:43 -0500)]
Also provide LIBEFIVAR_1.2X even though nothing really uses it.
We've exported these names before, so we still have to have them.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 27 Oct 2016 13:14:18 +0000 (09:14 -0400)]
Make AcpiAdr() device paths format correctly for display.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 27 Oct 2016 13:19:18 +0000 (09:19 -0400)]
Use -z muldefs to avoid the multiple definitions bug without -flto
This fixes github issue #64
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 20:12:08 +0000 (15:12 -0500)]
Make sure we define the version for new symbols recently added...
Because symbol versioning is a nightmare, this tool has shown that we've
got an error where we changed the version on some things by accident:
https://abi-laboratory.pro/tracker/compat_report/efivar/29/30/e3de7/abi_compat_report.html
Make those keep the 1.30 version forever.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 19:41:58 +0000 (14:41 -0500)]
New gcc version, new way symbol versioning breaks.
Apparently I get to redo this every time there's a compiler release.
Yaaaaaay.
Anyway, the current method is to define the two compat things from the
land before time as @libefivar.so.0 symbols and list them there in the
link map. Then we have the real one defined with another name, and set
as efi_set_variable@@LIBEFIVAR_0.24. Then to make there actually be a
efi_set_variable symbol to link against, we create it as a weak alias.
This is all completely absurd.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 19:28:19 +0000 (14:28 -0500)]
Remove some extra "const" that gcc complains about.
One of these days I'll get these right.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 6 Feb 2017 19:17:09 +0000 (14:17 -0500)]
Fix some allocation bounds checking gcc 7.x finds sometimes.
gcc 7.0.1 has -Walloca-larger-than=N and -Walloc-size-larger-than=N
flags that -O2 enables now, and they try to bounds check arguments to
alloca() and malloc().
Unfortunately they have horrible error messages, so you get:
dp-message.c: In function ‘_format_message_dn’:
dp-message.c:422:9: error: argument 1 range [
9223372036854775809,
18446744073709551615] exceeds maximum object size
9223372036854775807 [-Werror=alloc-size-larger-than=]
addr0 = alloca(sz+1);
^
dp-message.c:422:9: note: in a call to built-in allocation function ‘__builtin_alloca’
When what it means is:
Check for error you nitwit. Now I'm going to tell you a pile of math
we did that isn't useful to you at all.
And also:
dp-message.c:466:3: error: argument 1 value ‘
18446744073709551606’ exceeds maximum object size
9223372036854775807 [-Werror=alloc-size-larger-than=]
format_ucs2(buf, size, off, "UsbWwid",
^
dp-message.c:466:3: note: in a call to built-in allocation function ‘__builtin_alloca_with_align’
dp-message.c:466:3: error: ‘memset’: specified size
18446744073709551606 exceeds maximum object size
9223372036854775807 [-Werror=stringop-overflow=]
dp-message.c:466:3: error: ‘memcpy’: specified size
18446744073709551604 exceeds maximum object size
9223372036854775807 [-Werror=stringop-overflow=]
Which actually means:
You accidentally made the predicating check for bounds be against a
signed value Now I'm going to tell you a pile of useless data about
where you later used the result instead of telling you about the
problem.
Anyway, this fixes it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Dwayne Litzenberger [Thu, 19 Jan 2017 00:35:46 +0000 (16:35 -0800)]
format_media_dn: Fix formatting of disk signature for MBR partitions
The previous logic sign-extended the least-significant byte of the disk
signature and returned a decimal number prefixed with "0x", producing
nonsense like this:
# blkid -o value -s PTUUID /dev/sdb
927a7490
# efibootmgr -v | grep debian
Boot0002* debian HD(3,MBR,0x4294967184,0xe89c0000,0x100000)/File(\EFI\debian\grubx64.efi)
# python -c 'print hex(
4294967184)'
0xffffff90
With this change, it works properly:
Boot0002* debian HD(3,MBR,0x927a7490,0xe89c0000,0x100000)/File(\EFI\debian\grubx64.efi)
Signed-off-by: Dwayne Litzenberger <dlitz@dlitz.net>
Nicolas George [Sun, 13 Nov 2016 18:04:30 +0000 (19:04 +0100)]
linux: fix device major/minor handling.
The current code fails when minor >= 256 because the higher
bits are kept in major.
Fix: Debian bug #844237
Peter Jones [Wed, 19 Oct 2016 18:59:35 +0000 (14:59 -0400)]
_format_message_dn(): fix the check for a label in the EFIDP_MSG_VENDOR case.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 19 Oct 2016 18:18:27 +0000 (14:18 -0400)]
efidp_is_multiinstance(): check for efidp_next_node() == 0 in our iter
GCC doesn't seem to want to believe that the NULL and length tests in
in efidp_is_multiinstance()->efidp_next_node()->efidp_node_size()
actually catches things, Possibly because it wouldn't be acted on until
the next iteration through the loop. So check that case explicitly in
efidp_is_multiinstance(). Also forcibly set 'next' to NULL, to ensure
efidp_next_node() will catch it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 19 Oct 2016 18:18:45 +0000 (14:18 -0400)]
efidp_*(): make everything that does pointer math check for overflow.
None of these overflows will really happen in the real world, because
they depend on the address of the next-to-last efidp_header being 4
bytes from the top of memory, but check them anyway.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 28 Sep 2016 13:28:24 +0000 (09:28 -0400)]
lib*: provide LIBEFIVAR_1.28 etc.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 17 Oct 2016 14:04:48 +0000 (10:04 -0400)]
Check for the NVMe EUI in the base sysfs dir for the device as well
Kernel commit
779ff75617099f4defe14e20443b95019a4c5ae8 moves the NVMe
attributes from being under nvme0n1/device/* to just being in the
nvme0n1/ directory. So now we get to check for both things. Thanks,
sysfs.
This resolves github issue #65
This resolves https://github.com/rhinstaller/efibootmgr/issues/48
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 27 Sep 2016 18:21:13 +0000 (14:21 -0400)]
Bump version to 30
- Fix efidp_*() functions with __pure__ that break with some optimizations
- Fix NVMe EUI parsing.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 27 Sep 2016 19:41:21 +0000 (15:41 -0400)]
Don't use __pure__ on efidp_*() functions.
The compiler keeps introducing off by one errors with -O2 but not with
-Og and I'm not sure why, so just don't do this optimization.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 27 Sep 2016 18:21:13 +0000 (14:21 -0400)]
linux: Fix NVMe EUI parsing from sysfs
The kernel uses space as separators, whereas for some reason I'd coded
the parser to expect dashes.
Fixes the last thing from https://github.com/rhinstaller/efibootmgr/issues/48
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 27 Sep 2016 18:01:18 +0000 (14:01 -0400)]
Bump version to 29
- Use -pie not -PIE in our linker config
- Fix some overflow checks for gcc < 5.x
- Make variable class probes other than the first one actually work
- Move -flto to CFLAGS
- Pack all of the efi device path headers
- Fix redundant decl of efi_guid_zero()
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 27 Sep 2016 17:48:14 +0000 (13:48 -0400)]
efivar-dp.h: Actually add the packed attribute everywhere.
Apparently
9b3155b095 was not enough, so pack all the device path
structures.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Sep 2016 20:30:40 +0000 (16:30 -0400)]
Fix redundant decl of efi_guid_zero.
This fixes github issue #62
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 13 Sep 2016 20:20:49 +0000 (16:20 -0400)]
All of our efi device path headers need to be packed.
So just pack efidp_header and be done with it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Mike Gilbert [Tue, 23 Aug 2016 14:14:39 +0000 (10:14 -0400)]
Move -flto to CFLAGS
LTO is an optimization that is not always desired. This allows it to be
easily disabled.
Peter Jones [Mon, 22 Aug 2016 15:42:50 +0000 (11:42 -0400)]
libefivar/libs.c:probe(): Fix the case where the first probe fails.
When adding efi_set_error() support, I accidentally changed it to treat
a probe failure as a success, which winds up meaning you always try
efivarfs even if the probe failed.
Fixes github issue https://github.com/rhinstaller/efibootmgr/issues/54
Fixes https://bugs.gentoo.org/show_bug.cgi?id=591864
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Mon, 22 Aug 2016 15:20:07 +0000 (11:20 -0400)]
Fix some cases of our overflow checkers in add_int() etc for gcc < 5
Basically do all the comparisons in our add checkers in "unsigned long
long" space.
Resolves github issue #58.
Signed-off-by: Peter Jones <pjones@redhat.com>
Mike Gilbert [Sat, 20 Aug 2016 22:13:32 +0000 (18:13 -0400)]
gcc.specs: link: change '-PIE' to '-pie' and drop '-PIC'
The ld manual does not mention -PIE or -PIC, and ld.gold fails when passed
either option.
The gcc manual mentions that -pie should be passed when linking objects
compiled with -fPIE.
Resolves: https://github.com/rhinstaller/efivar/issues/57
Peter Jones [Wed, 17 Aug 2016 13:01:38 +0000 (09:01 -0400)]
Bump version to 28
But bump our soname to lib$FOO.1 so it doesn't change constantly.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 17 Aug 2016 12:59:58 +0000 (08:59 -0400)]
Make soname always libfoo.1 not libfoo.
102312231.
Having the minor version change all the time makes sense. Having the
soname change does not.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 16 Aug 2016 20:33:03 +0000 (16:33 -0400)]
efivar 27
- Bug fix for
086eeb17 in efivar 26.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 16 Aug 2016 20:31:07 +0000 (16:31 -0400)]
creator/find_file(): fix the fix in
086eeb17
086eeb17 was right about needing a continue, but it still did actually
need >= instead of !=, because it's looking for a subset.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 11 Aug 2016 19:46:06 +0000 (15:46 -0400)]
util.h: add int_add for 32-bit platforms
Peter Jones [Thu, 11 Aug 2016 15:47:24 +0000 (11:47 -0400)]
Release efivar 26
- Rework version numbers.
- Add error tracking API.
- Remove use of deprecated readdir_r
- SATA device path fixes.
- Use symmacros.h to make newer compilers happy
- Fix a bug in efidp_size() double-counting End nodes sometimes.
- Handle nonnull comparisons in the headers more gracefully.
Peter Jones [Thu, 11 Aug 2016 18:09:44 +0000 (14:09 -0400)]
gcc: handle the nonnull comparison issue more gracefully.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 11 Aug 2016 15:45:45 +0000 (11:45 -0400)]
efi_loadopt_optional_data_size: add efi_error() trace code
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 11 Aug 2016 15:44:37 +0000 (11:44 -0400)]
efidp_size: don't count the end node twice.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 10 Aug 2016 20:47:41 +0000 (16:47 -0400)]
libefivar: use sysmacros.h
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 14:59:04 +0000 (10:59 -0400)]
Use efi_error() at lots of places.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 4 Aug 2016 17:48:34 +0000 (13:48 -0400)]
efivar: add an api to inspect errors that occurred in more detail.
I'm tired of manually debugging everything in the world, so add this API
that gives our callers more detail and verbosity about errors that
occur.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 15:06:40 +0000 (11:06 -0400)]
dp.h: make our format() macro adjust "off" automatically.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 14:47:47 +0000 (10:47 -0400)]
efivar-dp.h: add a bunch of compiler hints as function attributes.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 14:44:07 +0000 (10:44 -0400)]
efivar-dp.h: make our iterators/size checkers a bit saner
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 14:00:24 +0000 (10:00 -0400)]
dp-message: make format_ipv6_port_helper() use the common formatting macros.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 9 Aug 2016 13:55:06 +0000 (09:55 -0400)]
dp-*: fix some wrong size_t vs ssize_t usage.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Fri, 5 Aug 2016 21:06:29 +0000 (17:06 -0400)]
util.h: add some math utilities
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 4 Aug 2016 15:24:15 +0000 (11:24 -0400)]
sata device paths: treat the kernel's ata device number as 1-indexed.
Fix yet another place where this being 1-indexed in the linux kernel but
not anywhere else burns us.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 4 Aug 2016 15:21:22 +0000 (11:21 -0400)]
Correctly handle Sata() device paths PMPN sentinal value.
We rarely wind up writing a full Sata() device path, so nobody noticed
that for the SATA PMPN (port multiplier number) sentinal value that
means "no port multiplier", i.e. the normal case, we were storing 0x8000
instead of 0xffff, and that's not correct.
Partially fixes github issue#47 .
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 4 Aug 2016 17:49:57 +0000 (13:49 -0400)]
creator/find_file(): fix an incorrect error that gets raised.
In find_file(), when we're trying to find the device that matches a
mountpoint, we incorrectly raise an error when we find an entry that's
got a longer name than the one we want. This is incorrect - it's a
special case of what Lans Zhang was fixing in
8eac2d51, in fact.
This case should just reject *that* entry, not set an error and end the
iteration.
Signed-off-by: Peter Jones <pjones@redhat.com>
Andreas Schwab [Tue, 12 Jul 2016 08:34:50 +0000 (10:34 +0200)]
Remove use of deprecated readdir_r
Signed-off-by: Andreas Schwab <schwab@suse.de>
Peter Jones [Tue, 19 Jul 2016 15:02:01 +0000 (11:02 -0400)]
Get rid of "0." and just make the next version be 25.
Seemed easier than deciding what a 1.0 will look like ;)
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 30 Jun 2016 15:32:03 +0000 (11:32 -0400)]
allow deprecated declarations for now to let readdir_r work...
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 30 Jun 2016 14:50:32 +0000 (10:50 -0400)]
Release 0.24
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 30 Jun 2016 14:34:14 +0000 (10:34 -0400)]
Promote efi_guid_cmp() and friends to not be inlined.
Some compilers seem to get confused with the current efi_guid_cmp()
invocation, so just make it real API.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 30 Jun 2016 14:25:28 +0000 (10:25 -0400)]
Fix a couple of places where we overuse const.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 30 Jun 2016 14:16:17 +0000 (10:16 -0400)]
Make efivar-dp.h inlines compatible with --std=c89
Some people still insist on compiling programs with a C standard from
the beginning of time, and that doesn't allow mixed declarations and
code.
We don't heavily depend on that, so this just fixes up the places where
we use it.
Fixes issue #54
Signed-off-by: Peter Jones <pjones@redhat.com>
Jeremy Compostella [Wed, 25 May 2016 14:50:47 +0000 (16:50 +0200)]
clang++ efi_guid_is_empty alias issue
As efi_guid_is_zero is static function, its name is mangled and the
__attribute__ ((weak, alias ("efi_guid_is_zero"))) is failing with
clang++.
Making efi_guid_is_zero a non-static function.
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Peter Jones [Tue, 24 May 2016 15:32:57 +0000 (11:32 -0400)]
loadopt: add some clarifying comments
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 24 May 2016 14:58:36 +0000 (10:58 -0400)]
efivar: typo, missing comma
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 19 May 2016 18:04:32 +0000 (14:04 -0400)]
libefivar: make it possible to override the filesystem paths
Peter Jones [Thu, 19 May 2016 14:54:06 +0000 (10:54 -0400)]
Fix some deginerate load option parsing cases.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 19 May 2016 14:53:51 +0000 (10:53 -0400)]
Make it easier to turn optimization off without other changes.
Signed-off-by: Peter Jones <pjones@redhat.com>
Ioan-Adrian Ratiu [Tue, 17 May 2016 11:47:34 +0000 (14:47 +0300)]
efivar: add decimal variable printing support
Default printing behaviour remains unchanged, however when one of the
print-decimal/d args is given, efivar will print in a simpler less
terse decimal format.
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Ioan-Adrian Ratiu [Tue, 17 May 2016 11:01:51 +0000 (14:01 +0300)]
efivar: add variable writing support
Transform append_variable() into a more generic edit_variable()
to handle both append and writing based on a flag. Define a new
write/w parameter which triggers the writing logic.
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Mike Gilbert [Fri, 15 Apr 2016 21:58:15 +0000 (17:58 -0400)]
Include sys/sysmacros.h when sys/types.h does not define major
glibc is planning to drop this from sys/types.h.
Erico Nunes [Wed, 23 Mar 2016 00:43:44 +0000 (21:43 -0300)]
Make.rules: fix build with make <= 3.81
Building with host make 3.81 resulted in an issue where src/efivar.pc
was never generated.
Even by running 'make efivar.pc' inside the src directory, make always
returned that there was nothing to do.
This was not observed when using make 3.82 or 4.x.
It is apparently caused by the assignment operators in the multi-line
defines in Make.rules, which do not seem to be supported by make 3.81.
By omitting the assignment operators, the rule works with both versions
of make.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Aaron Luft [Wed, 16 Mar 2016 22:53:59 +0000 (18:53 -0400)]
efidp_format_device_path: add enough input argument checking to avoid coredump
Peter Jones [Mon, 2 May 2016 20:46:23 +0000 (16:46 -0400)]
Debug some of our immutable bit hackery.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Tue, 12 Apr 2016 13:54:16 +0000 (09:54 -0400)]
Clean up some license confusion.
Basically when some of this got relicensed as LGPL, some of the license
text didn't get changed correctly. But it's still all LGPL, because
that's what COPYING says.
So fix the language in the individual files.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 10 Mar 2016 20:51:31 +0000 (15:51 -0500)]
libefivar: make efi loadopt path functions have useful limit checks
Make efi_loadopt_pathlen() and efi_loadopt_path() actually bounds check
against something useful, not just "does some possibly unallocated space
extend into some other possibly unallocated space".
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 10 Mar 2016 16:08:30 +0000 (11:08 -0500)]
Make sure -D_GNU_SOURCE is used on clang.
asprintf() requires _GNU_SOURCE to be defined, because the C standard
library is a joke.
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Thu, 10 Mar 2016 16:00:14 +0000 (11:00 -0500)]
Fix our "make deps" dependencies.
This should fix issue #32, finally.
Signed-off-by: Peter Jones <pjones@redhat.com>
Steve McIntyre [Wed, 20 Jan 2016 17:44:28 +0000 (17:44 +0000)]
Fixes for compilation with gcc 6
linux.c: Fix warnings about dereferencing type-punned pointers: switch
from char * to uint8_t * in various places
(Adapted from
https://github.com/steve-mcintyre/efivar-devel/commit/
67320177d01b872df4cc714a5fe20f6cadc54319
aka
c82b13556ae142cec420258b8563f0dabb3dad83 , where it originally
lived, by pjones.)
Signed-off-by: Peter Jones <pjones@redhat.com>
Mario Limonciello [Sat, 5 Mar 2016 22:14:52 +0000 (16:14 -0600)]
Pass correct expected devpath to efi_va_generate_file_device_path_from_esp
When using efi_generate_file_device_path, the devpath found by find_file
points to a partition.
efi_va_generate_file_device_path_from_esp and further downsteam code
expects to find the parent node of that partition.
Prior to this fix, tools that used efi_generate_file_device_path would
generate invalid paths with NVMe disks.
Signed-off-by: Peter Jones <pjones@redhat.com>
Mario Limonciello [Sat, 5 Mar 2016 18:57:32 +0000 (12:57 -0600)]
Use detected partition number in call to efi_va_generate_file_device_path_from_esp
In efi_generate_file_device_path get_partition_number detects what
partition number is used for that device, but this doesn't actually get
used.
This potentially masks problems that might not be caught later on some
device types (such as NVMe - where this was initally found)
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 2 Mar 2016 19:46:15 +0000 (14:46 -0500)]
libefivar: get rid of our variadic mess in efi_set_variable()
Sometimes the linked output wasn't correctly choosing the right
functions, and we'd get undefined behavior and the result was random
file modes on efi variables.
Instead, require the mode, and provide a compatibility symbol with the
older version that will use a safe (if mildly annoying) mode of
(0600 & ~umask).
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 2 Mar 2016 19:23:21 +0000 (14:23 -0500)]
libefivar: make the nvme sysfs bits look even more like the sas bits
Signed-off-by: Peter Jones <pjones@redhat.com>
Peter Jones [Wed, 2 Mar 2016 16:17:48 +0000 (11:17 -0500)]
efivar: fix some leaked symbols
Signed-off-by: Peter Jones <pjones@redhat.com>