Bug 2329849

Summary: pgvector built with x86-64-v4 feature level
Product: [Fedora] Fedora Reporter: Joachim Folz <joachim.folz>
Component: postgresql16-pgvectorAssignee: Filip Januš <fjanus>
Status: CLOSED ERRATA QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 41CC: andrew, fjanus
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: postgresql16-pgvector-0.6.2-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-18 03:04:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joachim Folz 2024-12-02 10:36:11 UTC
Hello,

After installing pgvector, when trying to load the extension with `CREATE EXTENSION vector;`, the postgresql server crashes. dmesg shows invalid opcode:

[   83.041426] traps: postgres[4440] trap invalid opcode ip:7f49a6175c96 sp:7ffff9ed3380 error:0 in vector.so[14c96,7f49a6166000+13000]

My CPU is compatible with x86-64-v3 (Ryzen 6000), whereas vector.so seems to be built with feature level x86-64-v4:

$ readelf -a -W /usr/lib64/pgsql/vector.so 
[...]
Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000030	NT_GNU_PROPERTY_TYPE_0	      Properties: x86 feature: IBT, SHSTK, x86 feature used: x86, XMM, YMM, ZMM, XSAVE, x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v4
[...]

IMO support for x86-64-v4 is quite rare and even recent CPU models do not support it, so packages should not be built against it.

Reproducible: Always

Steps to Reproduce:
1. Install postgresql, pgvector
2. Start postgresql
3. Create a database `createdb vectortest`
4. Load pgvector extension `psql vectortest -c "CREATE EXTENSION vector;"`
Actual Results:  
Postgresql server crashes.

Expected Results:  
Vector extension is loaded.

Comment 1 Andrew Kane 2025-01-08 20:33:26 UTC
Hi Filip, thanks for adding this package.

Adding OPTFLAGS="" to the make command should fix this.

https://github.com/pgvector/pgvector?tab=readme-ov-file#portability

Comment 2 Filip Januš 2025-01-09 09:26:15 UTC
Hi all, 
I will take a look ASAP.

Comment 3 Fedora Update System 2025-01-09 12:47:40 UTC
FEDORA-2025-eb449f1834 (postgresql16-pgvector-0.6.2-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb449f1834

Comment 4 Filip Januš 2025-01-09 12:48:06 UTC
fixed by https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb449f1834

Comment 5 Andrew Kane 2025-01-09 18:04:32 UTC
Awesome, thanks Filip!

Comment 6 Fedora Update System 2025-01-10 03:12:00 UTC
FEDORA-2025-eb449f1834 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-eb449f1834`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb449f1834

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2025-01-18 03:04:34 UTC
FEDORA-2025-eb449f1834 (postgresql16-pgvector-0.6.2-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.