Bug 1954422

Summary: [34 Regression] libgcrypt-1.9.2-2.fc34.x86_64 lost CET protection
Product: Red Hat Enterprise Linux 9 Reporter: Jakub Jelen <jjelen>
Component: libgcryptAssignee: Jakub Jelen <jjelen>
Status: CLOSED CURRENTRELEASE QA Contact: Alexander Sosedkin <asosedki>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 9.0CC: asosedki, codonell, crypto-team, extras-qa, fweimer, hongjiu.lu, jjelen, tm
Target Milestone: betaKeywords: Triaged
Target Release: 9.0 BetaFlags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libgcrypt-1.9.3-2.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 1954049 Environment:
Last Closed: 2021-12-07 21:24:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1954049    
Bug Blocks:    
Attachments:
Description Flags
A patch none

Description Jakub Jelen 2021-04-28 07:16:09 UTC
We need to fix this also in RHEL9 as it has the same version as Fedora now. Morover, this seems super-easy to automatically check in gating tests to avoid the same issue in the future.

+++ This bug was initially created as a clone of Bug #1954049 +++

[root@gnu-tgl-1 hjl]# rpm -qf /lib64/libgcrypt.so.20     
libgcrypt-1.9.2-2.fc34.x86_64
[root@gnu-tgl-1 hjl]# readelf -n /lib64/libgcrypt.so.20 | grep feature
[root@gnu-tgl-1 hjl]# 

[hjl@gnu-efi-2 ~]$ rpm -qf /lib64/libgcrypt.so.20    
libgcrypt-1.8.7-1.fc33.x86_64
[hjl@gnu-efi-2 ~]$ readelf -n /lib64/libgcrypt.so.20 | grep feature 
	x86 feature: IBT, SHSTK
[hjl@gnu-efi-2 ~]$

--- Additional comment from Jakub Jelen on 2021-04-27 16:11:24 CEST ---

Hi, do you have some hints where do these come from (compiler flags, configuration?)?

Does it work with new 1.9.3 version?

https://bodhi.fedoraproject.org/updates/FEDORA-2021-54a91de592

--- Additional comment from Jakub Jelen on 2021-04-27 16:31:22 CEST ---

ok, the version 1.9.3 is not any better:

[root@fedora34 ~]# readelf -n /lib64/libgcrypt.so.20 | grep feature

Probably this?

https://src.fedoraproject.org/rpms/libgcrypt/c/8c18517a2519c8acbf705612db701c063990ff59

I read it as it is available in master already. Unfortunately, there is no better reference. Let me check.

--- Additional comment from H.J. Lu on 2021-04-27 16:41:14 CEST ---

Let me take a look to fix it.

--- Additional comment from H.J. Lu on 2021-04-27 18:52:41 CEST ---

This patch:

https://gitlab.com/cet-software/libgcrypt/-/commit/b04c0a86b19856071c29d2a6285f3240c606ee7a

should work.

--- Additional comment from Jakub Jelen on 2021-04-27 20:39:31 CEST ---

Thank you. I verified that the local build has the expected flags.

Did you submit the patch upstream already or should I do that?

--- Additional comment from H.J. Lu on 2021-04-27 21:47:35 CEST ---

(In reply to Jakub Jelen from comment #5)
> Thank you. I verified that the local build has the expected flags.
> 
> Did you submit the patch upstream already or should I do that?

https://lists.gnupg.org/pipermail/gcrypt-devel/2021-April/005147.html

Comment 1 H.J. Lu 2021-04-28 15:15:01 UTC
Created attachment 1776775 [details]
A patch

This is the patch I am using to catch CET regressions.

Comment 3 Jakub Jelen 2021-04-28 17:23:29 UTC
(In reply to H.J. Lu from comment #1)
> Created attachment 1776775 [details]
> A patch
> 
> This is the patch I am using to catch CET regressions.

Thanks. Does this have some side effects aside of failing when the CET is not properly applied? Would it make sense to Fedora to integrate it into the RPM CFLAGS globally? Or it makes sense only for the "important" packages?

Comment 4 H.J. Lu 2021-04-28 17:34:07 UTC
(In reply to Jakub Jelen from comment #3)
> (In reply to H.J. Lu from comment #1)
> > Created attachment 1776775 [details]
> > A patch
> > 
> > This is the patch I am using to catch CET regressions.
> 
> Thanks. Does this have some side effects aside of failing when the CET is

If CET isn't properly enabled in the final linker output, the link will fail.

> not properly applied? Would it make sense to Fedora to integrate it into the
> RPM CFLAGS globally? Or it makes sense only for the "important" packages?

It should be used to create packages which have been known to be CET enabled.