Bug 1806061 - libffi isn't CET enabled
Summary: libffi isn't CET enabled
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: libffi
Version: 33
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1688387 1802674 1806314
TreeView+ depends on / blocked
 
Reported: 2020-02-21 22:00 UTC by H.J. Lu
Modified: 2021-11-30 17:29 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-30 17:29:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github libffi libffi pull 540 0 None closed x86: Add indirect branch tracking support 2020-12-22 03:12:50 UTC

Description H.J. Lu 2020-02-21 22:00:41 UTC
There are 2 problems:

1. libffi itself isn't CET enabled.
2. libffi trampoline isn't CET enabled.  This is a bigger problem since
loader allocates legacy bitmap for libffi.so since it isn't CET enabled.
But legacy bitmap doesn't cover trampoline generated by libffi.

The fix for libffi master branch is at

https://github.com/libffi/libffi/pull/540

Backport to libffi 3.1 is also available.

Comment 1 H.J. Lu 2020-02-21 23:13:12 UTC
After libffi is fixed with larger trampoline with ENDBR, all packages which
use libffi must be recompiled with larger ffi_closure.

Comment 2 Anthony Green 2020-02-21 23:59:23 UTC
Hi HJ,

  Where can I read more about CET?  If there a Fedora mandate to move to CET-enabled builds?  Or is that only supported for certain processors?

  There's a pending ABI-breaking libffi update for Fedora, but if I have to break it again, I might as well make a new release with this and do it all at once.

Comment 3 H.J. Lu 2020-02-22 02:44:35 UTC
(In reply to Anthony Green from comment #2)
> Hi HJ,
> 
>   Where can I read more about CET?  If there a Fedora mandate to move to

Intel Control-flow Enforcement Technology (CET):

https://software.intel.com/en-us/articles/intel-sdm

contains shadow stack (SHSTK) and indirect branch tracking (IBT).  When
CET is enabled, ELF object files must be marked with .note.gnu.property
section.  Also when IBT is enabled, all indirect branch targets must
start with ENDBR instruction which is a NOP on non-CET processor.

Fedora will be the first CET enabled OS:

https://bugzilla.redhat.com/show_bug.cgi?id=1538725


> CET-enabled builds?  Or is that only supported for certain processors?

CET support is backward compatible.

>   There's a pending ABI-breaking libffi update for Fedora, but if I have to
> break it again, I might as well make a new release with this and do it all
> at once.

Yes, we need to bump to libffi.so.8 since FFI_TRAMPOLINE_SIZE is increased
unconditionally.

Comment 4 H.J. Lu 2020-02-22 02:54:38 UTC
compat-libffi31 will be needed.

Comment 5 Anthony Green 2020-02-22 10:43:34 UTC
This patch caused a regression with building/testing with gcc -m32 and g++ -m32.  Could you please have a look?

Comment 7 Fedora Admin XMLRPC Client 2020-02-27 04:27:49 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.

Comment 8 Ben Cotton 2020-08-11 15:26:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 9 H.J. Lu 2020-12-22 03:18:52 UTC
I implemented trampoline table with compatible closure for libffi 3.1 on hjl/cet/2014-05-11 branch:

https://github.com/hjl-tools/libffi/tree/hjl/cet/2014-05-11

It passed tests on Tiger Lake.

Comment 10 H.J. Lu 2020-12-22 16:52:58 UTC
I update hjl/cet/2014-05-11 branch to enable 32-bit trampoline table.

Comment 11 Ben Cotton 2021-11-04 16:28:27 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Ben Cotton 2021-11-30 17:29:44 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.