Bug 1789089

Summary: JIT in pcre2 doesn't support CET
Product: [Fedora] Fedora Reporter: H.J. Lu <hongjiu.lu>
Component: pcre2Assignee: Petr Pisar <ppisar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: ppisar
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://bugs.exim.org/show_bug.cgi?id=2509
Whiteboard:
Fixed In Version: pcre2-10.35-0.1.RC1.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-09 07:41:54 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:    
Bug Blocks: 1802674    

Description H.J. Lu 2020-01-08 17:34:56 UTC
On TGL,

$ git grep file_end
...
[ 9631.412090] traps: git[1226522] control protection ip:7f0cd6e12e80 sp:7f0cc4b62b58 error:3(endbranch)
(gdb) bt
#0  0x00007f6e13778580 in ?? ()
#1  0x00007f6e136e3be8 in jit_machine_stack_exec () from /lib64/libpcre2-8.so.0
#2  0x00007f6e13710299 in pcre2_jit_match_8 () from /lib64/libpcre2-8.so.0
#3  0x000055ecc89e7dc5 in patmatch ()
#4  0x000055ecc89e8fb4 in grep_source_1 ()
#5  0x000055ecc890b33a in run ()
#6  0x00007f6e136944e2 in start_thread () from /lib64/libpthread.so.0
#7  0x00007f6e135c34b3 in clone () from /lib64/libc.so.6
(gdb) disass 140110749730176,+16
Dump of assembler code from 0x7f6e13778580 to 0x7f6e13778590:
   0x00007f6e13778580:    push   %rbx  <<< Missing ENDBR64
   0x00007f6e13778581:    push   %r15
   0x00007f6e13778583:    push   %r14
   0x00007f6e13778585:    push   %r13
   0x00007f6e13778587:    push   %rbp
   0x00007f6e13778588:    mov    %rdi,%rbx
   0x00007f6e1377858b:    sub    $0x50,%rsp
   0x00007f6e1377858f:    mov    0x10(%rbx),%rax
End of assembler dump.
(gdb)

Comment 1 Petr Pisar 2020-01-09 07:41:54 UTC
Thank you for your concerns about PCRE2 code. Because this issue is not specific to Fedora, I forwarded your request to PCRE2 authors. <https://bugs.exim.org/show_bug.cgi?id=2509>  Please follow up there. Fedora will inherit CET support from upstream when it become available there. I will close this Fedora bug report is it must be dealt in upstream.

Comment 2 Petr Pisar 2020-01-09 13:34:20 UTC
PCRE2 author needs more detailed guiding what to do. What kind of jumps should be instrumented and what instructions should be used. H.J. Lu, please give him advice.

Comment 3 Petr Pisar 2020-02-13 17:25:25 UTC
The CET enablement landed to PCRE2 upstream with:

commit d0968b38f5e570f4eb061297c1b9f90e7c2a1396
Author: zherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>
Date:   Tue Jan 28 14:13:06 2020 +0000

    JIT compiler update.
    
    git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1215 6239d852-aaf2-0410-a92c-79f79f948069

When PCRE2 10.35 is released, this feature will emerge in Fedora.