Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2227356

Summary: breakpoint in vandps instruction causes register clobber
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: gdbAssignee: Keith Seitz <keiths>
gdb sub component: system-version QA Contact: qe-baseos-tools-bugs
Status: CLOSED MIGRATED Docs Contact:
Severity: medium    
Priority: medium CC: gdb-bugs, hartsjc, ohudlick
Version: 8.6Keywords: MigratedToJIRA, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-22 16:00:37 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:
Attachments:
Description Flags
gdb_avx_issue.tar none

Description Paulo Andrade 2023-07-28 20:37:25 UTC
Created attachment 1980527 [details]
gdb_avx_issue.tar

Example reproducer:

$ tar xf gdb_avx_issue.tar
$ cd gdb_avx_issue/
$ ./build
$ ./run 
Out 0: 0xdeadbeef
Out 1: 0xdeadbeef
Out 2: 0xdeadbeef
Out 3: 0xdeadbeef
Out 4: 0xdeadbeef
Out 5: 0xdeadbeef
Out 6: 0xdeadbeef
Out 7: 0xdeadbeef

  Now in gdb:

$ gdb run
...
(gdb) b test_func
Breakpoint 1 at 0x401240: file /usr/lib/gcc/x86_64-redhat-linux/11/include/avxintrin.h, line 174.
(gdb) r
...
Breakpoint 1, test_func (x=...) at test.c:12
12	  return _mm256_and_ps(x, constants[512]);
(gdb) c
Continuing.
Out 0: 0x00000000
Out 1: 0x00000000
Out 2: 0x00000000
Out 3: 0x00000000
Out 4: 0x00000000
Out 5: 0x00000000
Out 6: 0x00000000
Out 7: 0x00000000

This issue appears to happen not just in rhel8 but any other recent environment
tested with different gdb major versions.

For the reproducer, the issue appear to only happen if the breakpoint is in the
vandps instruction, but probably might trigger in other instructions or
conditions.

(gdb) p $ymm0
$1 = {..., v8_int32 = {-1, -1, -1, -1, -1, -1, -1, -1}, ... }
(gdb) watch $ymm0
Watchpoint 2: $ymm0
(gdb) disassemble 
Dump of assembler code for function test_func:
=> 0x0000000000401240 <+0>:	vandps 0x6e18(%rip),%ymm0,%ymm0        # 0x408060 <constants+16384>
   0x0000000000401248 <+8>:	ret
End of assembler dump.
(gdb) si

Watchpoint 2: $ymm0

Old value = {..., v8_int32 = {-1, -1, -1, -1, -1, -1, -1, -1}, ...}
New value = {..., v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, ...}
0x0000000000401248 in test_func (x=...) at test.c:18
18	}

Comment 1 Paulo Andrade 2023-08-07 20:45:33 UTC
Any news? On a quick sampling with:

$ lldb -v
lldb version 13.0.1

it works, but failed will all gdb versions I tested.

$ lldb run
(lldb) target create "run"
Current executable set to '/home/pcpa/gdb_avx_issue/run' (x86_64).
(lldb) b test_func
Breakpoint 1: where = run`test_func [inlined] _mm256_and_ps at avxintrin.h:174:19, address = 0x0000000000401240
(lldb) r
Process 1489184 launched: '/home/pcpa/gdb_avx_issue/run' (x86_64)
Process 1489184 stopped
* thread #1, name = 'run', stop reason = breakpoint 1.1
    frame #0: 0x0000000000401240 run`test_func [inlined] _mm256_and_ps(__B=([0] = -6.2598534E+18, [1] = -6.2598534E+18, [2] = -6.2598534E+18, [3] = -6.2598534E+18, [4] = -6.2598534E+18, [5] = -6.2598534E+18, [6] = -6.2598534E+18, [7] = -6.2598534E+18), __A=<unavailable>) at avxintrin.h:174:19
   171 	extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
   172 	_mm256_and_ps (__m256 __A, __m256 __B)
   173 	{
-> 174 	  return (__m256) __builtin_ia32_andps256 ((__v8sf)__A, (__v8sf)__B);
   175 	}
   176 	
   177 	extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
(lldb) p $ymm0
(unsigned char __attribute__((ext_vector_type(32)))) $0 = (0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)
(lldb) disassemble 
run`test_func:
->  0x401240 <+0>: vandps 0x6e18(%rip), %ymm0, %ymm0 ; constants + 16384
    0x401248 <+8>: retq   
(lldb) si
Process 1489184 stopped
* thread #1, name = 'run', stop reason = instruction step into
    frame #0: 0x0000000000401248 run`test_func(x=<unavailable>) at test.c:13:1
   10  	
   11  	__m256 test_func(__m256 x) {
   12  	  return _mm256_and_ps(x, constants[512]);
-> 13  	}
(lldb) p $ymm0
(unsigned char __attribute__((ext_vector_type(32)))) $1 = (0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde)
(lldb) c
Process 1489184 resuming
Out 0: 0xdeadbeef
Out 1: 0xdeadbeef
Out 2: 0xdeadbeef
Out 3: 0xdeadbeef
Out 4: 0xdeadbeef
Out 5: 0xdeadbeef
Out 6: 0xdeadbeef
Out 7: 0xdeadbeef
Process 1489184 exited with status = 0 (0x00000000) 
(lldb) q

Comment 2 Keith Seitz 2023-08-07 20:48:11 UTC
I will be looking into this tomorrow.

Comment 3 Keith Seitz 2023-08-09 14:45:51 UTC
While I do not specifically have a solution for the problem, I can
offer two workarounds which should help until a proper solution is
developed.

1) Use gdbserver.
2) Disable displaced stepping (set displaced-stepping off).
   [This can be added to a .gdbinit, e.g., or passed on command-line
    with -ex or -iex.]

Comment 4 RHEL Program Management 2023-09-22 15:56:35 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 5 RHEL Program Management 2023-09-22 16:00:37 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.