| Summary: | swupd compatibility with image-prelink | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Other YP Layers | Reporter: | Patrick Ohly <patrick.ohly> |
| Component: | meta-swupd | Assignee: | Patrick Ohly <patrick.ohly> |
| Status: | RESOLVED OBSOLETE | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Undecided | CC: | brian.avery, elena.reshetova, randy.macleod, richard.purdie |
| Version: | unspecified | ||
| Target Milestone: | Future | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
| Bug Depends on: | 10268 | ||
| Bug Blocks: | |||
|
Description
Patrick Ohly
2016-10-28 06:50:40 UTC
Elena, can you provide some advice on prelinking (https://linux.die.net/man/8/prelink) and its security implications vs. expected performance increase? See also https://lwn.net/Articles/341244/ for some (very old!) discussion. I'm wondering what the current thinking about this feature is in the security community. See also http://lists.openembedded.org/pipermail/openembedded-core/2015-October/112004.html So, in short nothing really changed much in prelink world. It is still bad from security point of view since it removes ASLR almost fully. Nowadays prelink comes with -R random option that attempts to randomize load address to be not so horrible from security point of view, but it seems that this address is pretty easy to discoved on running system, so it doesn't add any additional protection in practice. So, conclusion from security point of view: do not use prelink unless absolutely required and be aware of its security implications: mainly return into libc attacks become rather trivial. In Bug 10268 I outline the 2 things that introduce the randomization. 1) We *do* use -R by default and this does introduce binary differences. 2) Prelink includes a timestamp for when each library was prelinked. This cannot currently br turned off with an option so this will always introduce binary differences unless we patch prelink. You can also use prelink itself to do binary compares which essentially unlink compare and relink the binaries. More info at https://wiki.yoctoproject.org/wiki/TipsAndTricks/PrelinkSomePointersAndWorkarounds Default usage of -R flag is certainly better than not using it from security point of view, but it should not be confused with having proper security that ALSR can give in run-time. Just want to make sure everyone understands this. My conclusion is that supporting prelinking in combination with swupd updates is neither required nor recommended. A device where prelinking is useful enough to justify the disadvantages is likely too small to run swupd. Therefore I intend to resolve this issue here by adding a check in meta-swupd which warns when prelinking is enabled. That works for me. If someone really needs it to work with prelinking, the 2 things that need to be changed are straightforward, though, as Elena points out, 1 of them makes it even less secure. (no -R, patch to remove timestamp data which is only used for an on target re prelinking optimization) Basic gain on QEMU system was ~ 10-15% faster. Upstream swupd has changed a lot and integration with the Yocto Project would be tricky and need rework to the layer. Closing this as obsolete since any new integration would need rework and have its own issues. |