Created attachment 397686 [details, diff]
longrun-0.9-r4 ebuild patch
app-admin/longrun fails to compile with musl on hardened because it uses loff_t in longrun.c. Can be fixed by adding "append-flags -D_GNU_SOURCE" in ebuild. Attached diff for your convenience.
Summary Build log:
x86_64-gentoo-linux-musl-gcc -O2 -pipe -fomit-frame-pointer -Wl,-O1 -Wl,--as-needed -DLOCALEDIR=\"/usr/share/locale\" -W -Wall -o longrun longrun.c
longrun.c:184:15: error: unknown type name ‘loff_t’
void read_msr(loff_t address, int *lower, int *upper)
longrun.c:196:16: error: unknown type name ‘loff_t’
void write_msr(loff_t address, int lower, int upper)
longrun.c:209:17: error: unknown type name ‘loff_t’
void read_cpuid(loff_t address, int *eax, int *ebx, int *ecx, int *edx)
longrun.c: In function ‘check_cpu’:
longrun.c:228:2: warning: implicit declaration of function ‘read_cpuid’ [-Wimplicit-function-declaration]
read_cpuid(CPUID_TMx86_VENDOR_ID, &eax, &ebx, &ecx, &edx);
longrun.c: In function ‘print_lrti_info’:
longrun.c:249:2: warning: implicit declaration of function ‘read_msr’ [-Wimplicit-function-declaration]
read_msr(MSR_TMx86_LRTI_READOUT, &junk, &max);
longrun.c:251:2: warning: implicit declaration of function ‘write_msr’ [-Wimplicit-function-declaration]
write_msr(MSR_TMx86_LRTI_READOUT, 0, max);
Makefile:6: recipe for target 'longrun' failed
make: *** [longrun] Error 1
ERROR: app-admin/longrun-0.9-r4::gentoo failed (compile phase):
ebuild.sh, line 93: Called src_compile
environment, line 2582: Called die
The specific snippet of code:
emake CC="$(tc-getCC)" || die "emake failed"
Created attachment 397688 [details]
Created attachment 397690 [details]
longrun build log
The loff_t can be safely replaced by off_t. That's the type used by pread()
and pwrite(). The relevant code is introduced by the patch from Debian,
which seems to be effectively the upstream for this package. It would be
good to try to get Debian to fix the patch.
Alright. I'll contact the Debian maintainer and get his input.
(In reply to Cato Auestad from comment #4)
> Alright. I'll contact the Debian maintainer and get his input.
This package is maintainer-needed, so I can go ahead and fix upt that patch. It sounds like its an artifact of the debian patch and not in the unpached code. Correct?
(In reply to Anthony Basile from comment #5)
> (In reply to Cato Auestad from comment #4)
> > Alright. I'll contact the Debian maintainer and get his input.
> This package is maintainer-needed, so I can go ahead and fix upt that patch.
> It sounds like its an artifact of the debian patch and not in the unpached
> code. Correct?
Correct. read_msr, write_msr and read_cpuid originally takes a "long address" but the Debian patch replaces it with "loff_t address".
I have submitted the patch to the Debian maintainer but haven't got a response yet.
I add a patch to change loff_t to off_t. The only consumer of off_t address in those functions is pread/pwrite() which take off_t as Felix said.
I'm going to close this for now, but redirect the debian maintainer here.
Actually I'm reopening so the workflow can indicate that its in the overlay but still has to be pushed upstream (in this case to the debian maintainer).