Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540196 - net-fs/openafs-kernel (all) fails to emerge on hardened sources due to "Undefined symbols in modules"
Summary: net-fs/openafs-kernel (all) fails to emerge on hardened sources due to "Undef...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: AMD64 All
: Normal major (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords: PMASKED
Depends on:
Blocks:
 
Reported: 2015-02-15 20:51 UTC by Kenan Avdic
Modified: 2018-07-08 14:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,4.85 KB, text/plain)
2015-02-15 20:51 UTC, Kenan Avdic
Details
build.log (build.log,313.45 KB, application/octet-stream)
2015-02-15 20:52 UTC, Kenan Avdic
Details
build.log (build.log,669.44 KB, text/plain)
2015-04-04 13:51 UTC, Kenan Avdic
Details
Fix emerge with undefined symbols (undef_syms_remove_forced_error.patch,1.10 KB, text/plain)
2015-04-04 15:13 UTC, Kenan Avdic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenan Avdic 2015-02-15 20:51:34 UTC
Created attachment 396552 [details]
emerge --info

All 3 versions of openafs-kernel currently available in portage (1.6.2-r1, 1.6.5-r1, ~1.6.5-r2) fail to emerge on hardened kernel 3.2.65-r2 with the error message:
/var/tmp/portage/net-fs/openafs-kernel-1.6.5-r2/work/openafs-1.6.5/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/osi_misc.c:120:2: error: invalid initializer
  afs_linux_path_t p = { mnt, dp };
  ^

This also affects openafs since it depends on openafs-kernel.

Steps to Reproduce:
1. Update kernel to latest available on hardened (3.2.65-r2)
2. Attempt to install net-fs/openafs (emerge net-fs/openafs)
Comment 1 Kenan Avdic 2015-02-15 20:52:15 UTC
Created attachment 396554 [details]
build.log
Comment 2 Andrew Savchenko gentoo-dev 2015-03-22 21:22:06 UTC
Please test with 1.6.11 version.
Comment 3 Kenan Avdic 2015-04-04 13:49:28 UTC
(In reply to Andrew Savchenko from comment #2)
> Please test with 1.6.11 version.

3.2.65-hardened-r2, openafs-kernel-1.6.11

make[5]: Leaving directory '/usr/src/linux-3.2.68-hardened'
Error: Undefined symbols in modules
Makefile.afs:241: recipe for target 'libafs.ko' failed
make[4]: *** [libafs.ko] Error 1
make[4]: Leaving directory '/var/tmp/portage/net-fs/openafs-kernel-1.6.11/work/openafs-1.6.11/src/libafs/MODLOAD-3.2.68-hardened-MP'
Makefile:138: recipe for target 'linux_compdirs' failed
make[3]: *** [linux_compdirs] Error 2
make[3]: Leaving directory '/var/tmp/portage/net-fs/openafs-kernel-1.6.11/work/openafs-1.6.11/src/libafs'
Makefile:483: recipe for target 'libafs' failed
make[2]: *** [libafs] Error 2
make[2]: Leaving directory '/var/tmp/portage/net-fs/openafs-kernel-1.6.11/work/openafs-1.6.11'
Makefile:692: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/var/tmp/portage/net-fs/openafs-kernel-1.6.11/work/openafs-1.6.11'
Makefile:42: recipe for target 'only_libafs' failed
make: *** [only_libafs] Error 2

The error looks like http://gerrit.openafs.org/#change,8981
Comment 4 Kenan Avdic 2015-04-04 13:51:12 UTC
Created attachment 400548 [details]
build.log

3.2.65-r2 with 1.6.11
Comment 5 Andrew Savchenko gentoo-dev 2015-04-04 14:14:15 UTC
Have openafs-kernel ever worked for you on a hardened kernel?

I really doubt it will, because kernel modules requires "Write protect kernel read-only data structures" (CONFIG_DEBUG_RODATA) to be *disabled*. And it should be enabled on hardened systems.
Comment 6 Kenan Avdic 2015-04-04 15:12:28 UTC
It hasn't worked *yet*, no. The package wasn't masked so I assumed it should work ;) I can confirm that module compilation at least requires GRKERNSEC_RANDSTRUCT to be off.

I've managed to emerge 1.6.11 with the attached patch.
http://gerrit.openafs.org/#change,8981 introduces a forced failure when there are module symbol mismatches during compilation, the patch reverts that change.
Comment 7 Kenan Avdic 2015-04-04 15:13:42 UTC
Created attachment 400562 [details]
Fix emerge with undefined symbols
Comment 8 Andrew Savchenko gentoo-dev 2015-04-04 16:25:15 UTC
Reverting this patch makes no good: undefined symbols in kernel module may hamper behaviour up to kernel panic. The proper fix will be to find these symbols and deal with them.

Have you tested that openafs-kernel not only compiles, but works properly? You should be able to start openafs-client and copy some data from some node on mounted /afs partition.
Comment 9 Adam Feldman gentoo-dev 2015-04-04 16:44:20 UTC
(In reply to Kenan Avdic from comment #3)
> The error looks like http://gerrit.openafs.org/#change,8981

This error message is the result of the patch that you reference.  Prior to that, it failed silently, or completed and then caused issues when using the module.

Regarding support, I've just spoken to a developer of OpenAFS who stated that that "hardened sources require that a number of data structures be initialized by C99 field names instead of explicit structure layouts. [...] Not all OpenAFS platforms support C99. [...] Supporting C99 would require dropping support for platforms or tons of ifdefs."

Thus, upstream doesn't support hardened sources and it is unlikely that they will do so anytime soon..
Comment 10 Andrew Savchenko gentoo-dev 2015-04-04 17:13:10 UTC
@hardened, should we mask net-fs/openafs-kernel on hardened profiles?
Comment 11 Adam Feldman gentoo-dev 2015-04-04 18:28:53 UTC
(In reply to Andrew Savchenko from comment #10)
> @hardened, should we mask net-fs/openafs-kernel on hardened profiles?

Also worth looking into, because it's on my list of things to do, whether net-fs/openafs works with the in-kernel CONFIG_AFS_FS.  If yes, I agree with that assertion, and make the client depend on the config or openafs-kernel.  If that doesn't pan out, I would say we should mask both openafs{,-kernel} on hardened.
Comment 12 Adam Feldman gentoo-dev 2015-04-04 19:23:19 UTC
(In reply to NP-Hardass from comment #11)
> (In reply to Andrew Savchenko from comment #10)
> > @hardened, should we mask net-fs/openafs-kernel on hardened profiles?
> 
> Also worth looking into, because it's on my list of things to do, whether
> net-fs/openafs works with the in-kernel CONFIG_AFS_FS.  If yes, I agree with
> that assertion, and make the client depend on the config or openafs-kernel. 
> If that doesn't pan out, I would say we should mask both openafs{,-kernel}
> on hardened.

Scratch that. Looks like the in-kernel AFS is a server and client.
Comment 13 Andrew Savchenko gentoo-dev 2015-04-04 19:32:02 UTC
(In reply to NP-Hardass from comment #11)

> Also worth looking into, because it's on my list of things to do, whether
> net-fs/openafs works with the in-kernel CONFIG_AFS_FS.

Ah, that is a common delusion. CONFIG_AFS_FS is completely independent implementation, sufficient on its own to mount /afs. See Documentation/filesystem/afs.txt in kernel src directory. That is: the only utility needed to mount /afs is mount. Of course, it is limited in functionality compared to openafs and is a bit harder to use.

> If that doesn't pan out, I would say we should mask both openafs{,-kernel}
> on hardened.

openafs can be used without openafs-kernel if someone is interested in the server only (see bug 239369).
Comment 14 Kenan Avdic 2015-04-06 11:27:35 UTC
(In reply to Andrew Savchenko from comment #8)
> Reverting this patch makes no good: undefined symbols in kernel module may
> hamper behaviour up to kernel panic. The proper fix will be to find these
> symbols and deal with them.
> 
You're right, it doesn't work even as a workaround. The module built is unusable.
Comment 15 Andrew Savchenko gentoo-dev 2015-05-01 15:58:03 UTC
net-fs/openafs-kernel and net-fs/openafs[modules] are now masked on hardened.
Comment 16 Francisco Blas Izquierdo Riera gentoo-dev 2018-07-08 14:43:55 UTC
Since the hardened-sources are now masked and unmaintained, could it be possible to lift this mask (or at least move it to the ebuild itself?).