Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 567678

Summary: Patch and comments to get efivar-0.21 to work with musl-hardened.
Product: Gentoo Linux Reporter: Damien Levac <damien.levac>
Component: HardenedAssignee: Gentoo musl team <musl>
Status: IN_PROGRESS ---    
Severity: normal CC: tsmksubc
Priority: Normal    
Version: autobuilds   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    
Attachments: Patch to remove gnu-specific functions from linux.c

Description Damien Levac 2015-12-06 20:46:24 UTC
Created attachment 418684 [details, diff]
Patch to remove gnu-specific functions from linux.c

When trying to emerge efivar-0.21 on musl-hardened, it first fails because the file /usr/include/bits/alltypes.h defines `wchar_t` on line 18. This is normally defined in stddef.h. To fix this I simply changed it to #include <stddef.h>, but I am not sure it is the way to go...

Once you get that out of the way, the compiles fails because src/linux.c uses `gnu_dev_major` and `gnu_dev_minor` instead of the portable `major` and `minor`. The patch included fixes that problem.

Once those two fixes are applied, efivar-0.21 emerge fine...
Comment 1 Anthony Basile gentoo-dev 2015-12-06 22:15:26 UTC
(In reply to Damien Levac from comment #0)
> Created attachment 418684 [details, diff] [details, diff]
> Patch to remove gnu-specific functions from linux.c
> 
> When trying to emerge efivar-0.21 on musl-hardened, it first fails because
> the file /usr/include/bits/alltypes.h defines `wchar_t` on line 18. This is
> normally defined in stddef.h. To fix this I simply changed it to #include
> <stddef.h>, but I am not sure it is the way to go...

Yes, that's POSIX

http://pubs.opengroup.org/onlinepubs/007908799/xsh/stddef.h.html

So I'm confused because your patch doesn't address this.  "To fix this I simply changed it ..."  Where did you make the change?

> 
> Once you get that out of the way, the compiles fails because src/linux.c
> uses `gnu_dev_major` and `gnu_dev_minor` instead of the portable `major` and
> `minor`. The patch included fixes that problem.
> 
> Once those two fixes are applied, efivar-0.21 emerge fine...

Okay so give me both.
Comment 2 Felix Janda 2015-12-06 22:44:05 UTC
There is an upstream bug report (including patches) at https://github.com/rhinstaller/efivar/pull/31
Comment 3 Anthony Basile gentoo-dev 2015-12-06 23:59:43 UTC
(In reply to Felix Janda from comment #2)
> There is an upstream bug report (including patches) at
> https://github.com/rhinstaller/efivar/pull/31

Thanks Felix.  I put efivar on the tree with your patch.  I'm not sure why its stalled upstream.  Both fixes are pretty straight forward.

Please test efivar-0.21-r99 which is on the overlay.
Comment 4 Aric Belsito 2016-01-10 08:13:58 UTC
sys-libs/efivar-0.21-r99 works for me.

I think this can be closed.
Comment 5 Steve Arnold archtester gentoo-dev 2018-01-09 19:48:56 UTC
I have the same error with sys-libs/efivar-31:0/1 (also on hardened musl) so maybe don't close it just yet?  Which overlay are the patches for the older version in?
Comment 6 Anthony Basile gentoo-dev 2018-01-09 19:56:49 UTC
(In reply to Steve Arnold from comment #5)
> I have the same error with sys-libs/efivar-31:0/1 (also on hardened musl) so
> maybe don't close it just yet?  Which overlay are the patches for the older
> version in?

efivar uses a some non-posix (and indeed dangerous) stuff, like strndupa.  those patches should go upstream.