You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault on xmlsec.tree.add_ids() in Python Development Mode #259
$ PYTHONDEVMODE=1 python boom.py
Debug memory block at address p=0x5556aed07c40: API '!'
15987178197214944733 bytes originally requested
The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
at p-7: 0x00 *** OUCH
at p-6: 0x00 *** OUCH
at p-5: 0x00 *** OUCH
at p-4: 0x00 *** OUCH
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
Because memory is corrupted at the start, the count of bytes requested
may be bogus, and checking the trailing pad bytes may segfault.
The 8 pad bytes at tail=0xddde33348cae5a1d are Fatal Python error: Segmentation fault
Current thread 0x00007fb7df1d8000 (most recent call first):
File "boom.py", line 6 in<module>
Extension modules: lxml._elementpath, lxml.etree, xmlsec (total: 3)
Segmentation fault
$
Environment
I'm running on Ubuntu 22.04 with system python 3.10.6 and xmlsec 1.3.13.
Hello just had a similar problem with xmlsec.tree.add_ids
program crash on this line without any error message
I solve the issue by falling back to lxml==4.9.3 instead of lxml==5.1.0
Brgds JL
Reacted by Wonjae Hwang, Eduard Maghakyan, NESIC) Naoya Kato, Patrick Dobson, Maylin Jeong, Petros Anagnou, Jake Lester, Enrique Matías Sánchez, AndPena, Yaroslav and 6 more
Reacted by Jake Lester, Yaroslav and Simon Wei(位西朋)
Reacted by Petros Anagnou, Rhenan, Jake Lester, AndPena, Yaroslav, chyok and Simon Wei(位西朋)
This fixed a problem for me too. It was causing a SAML SSO login failure for me. Has anyone submitted a bug to lxml? Their bug tracker is here: https://launchpad.net/lxml
@jlthorel thank you for saving us as well! You are the best!!!
We had issues recently with SSO on heroku where our ACS was failing. We isolated it to python3-saml validate_sign --> xmlsec xmlsec.tree.add_ids(elem, ["ID"]) ... thank you ❤️
Hello just had a similar problem with xmlsec.tree.add_ids program crash on this line without any error message I solve the issue by falling back to lxml==4.9.3 instead of lxml==5.1.0
OMG, this was driving me crazy: my SAML SSO was failing most of the times, but sometimes it did work 😠 .
Downgrading xml fixed the issue :-) Thanks a lot for the tip!!!
This fixed a problem for me too. It was causing a SAML SSO login failure for me. Has anyone submitted a bug to lxml? Their bug tracker is here: https://launchpad.net/lxml
Hello just had a similar problem with xmlsec.tree.add_ids program crash on this line without any error message I solve the issue by falling back to lxml==4.9.3 instead of lxml==5.1.0
Brgds JL
Thank you very much! This solution worked for me too.
This fixed a problem for me too. It was causing a SAML SSO login failure for me. Has anyone submitted a bug to lxml? Their bug tracker is here: https://launchpad.net/lxml
I believe commit ee9fbd0 by @jonathangreen avoids the segfault without any error message, and emits instead an exception ("lxml & xmlsec libxml2 library version mismatch").
However, it's still not clear to me what we should do to avoid it.
Hi @quique. My comment here gives some context #316 (comment) that might be helpful.
Basically to avoid the issue, either both lxml and xmlsec should be installed from wheels, or should both be installed with --no-binary set.
The most recent release for xmlsec supplies wheels for most platforms, so updating to the most recent and making sure that it it installed from via a wheel is probably the easiest fix.
Unfortunately it seems I'm quite thick today, because I am unable to make it work.
This is what I do:
docker run -it python:3.12-slim-bookworm /bin/bash
# Place sign1-res.xml and boom.py inside the container (see the issue report by @Anthchirp )
pip install lxml --only-binary=lxml
pip install xmlsec --only-binary=xmlsec
PYTHONDEVMODE=1 python boom.py # See it crash
If I understand it correctly, this way both lxml and xmlsec are installed from wheels, but I stil get a segmentation fault.
This is what I see:
root@d199d2820803:/# pip install lxml --only-binary=lxml
Collecting lxml
Downloading lxml-5.2.1-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (3.4 kB)
Downloading lxml-5.2.1-cp312-cp312-manylinux_2_28_x86_64.whl (4.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.9/4.9 MB 7.5 MB/s eta 0:00:00
Installing collected packages: lxml
Successfully installed lxml-5.2.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@d199d2820803:/# pip install xmlsec --only-binary=xmlsec
Collecting xmlsec
Downloading xmlsec-1.3.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.3 kB)
Requirement already satisfied: lxml>=3.8 in /usr/local/lib/python3.12/site-packages (from xmlsec) (5.2.1)
Downloading xmlsec-1.3.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.9/3.9 MB 7.2 MB/s eta 0:00:00
Installing collected packages: xmlsec
Successfully installed xmlsec-1.3.14
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@d199d2820803:/# python boom.py
root@d199d2820803:/# PYTHONDEVMODE=1 python boom.py
Debug memory block at address p=0x56499b02ca70: API '!'
6873730420813529088 bytes originally requested
The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
at p-7: 0x00 *** OUCH
at p-6: 0x00 *** OUCH
at p-5: 0x00 *** OUCH
at p-4: 0x00 *** OUCH
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
Because memory is corrupted at the start, the count of bytes requested
may be bogus, and checking the trailing pad bytes may segfault.
The 8 pad bytes at tail=0x5f64bbafc965ca70 are Fatal Python error: Segmentation fault
Current thread 0x00007fb0f0a63740 (most recent call first):
File "//boom.py", line 6 in<module>
Extension modules: lxml._elementpath, lxml.etree, xmlsec (total: 3)
Segmentation fault (core dumped)
Activity
Anthchirp commentedon Jun 15, 2023
I checked whether this is an lxml <-> xmlsec issue, but it is not:
jlthorel commentedon Jan 16, 2024
Hello just had a similar problem with xmlsec.tree.add_ids
program crash on this line without any error message
I solve the issue by falling back to lxml==4.9.3 instead of lxml==5.1.0
Brgds JL
wonjae-pro commentedon Jan 17, 2024
@jlthorel You saved my life...!! 👍
downpat commentedon Jan 23, 2024
This fixed a problem for me too. It was causing a SAML SSO login failure for me. Has anyone submitted a bug to lxml? Their bug tracker is here: https://launchpad.net/lxml
MaylinJeong commentedon Jan 26, 2024
@jlthorel You saved my life as well..! 💯
rhenanbartels commentedon Jan 30, 2024
@jlthorel You're a life saver!! Thank you very much!🎉🎉
I had the same problem as @downpa and my SAML login was failing because of lxml library
jake-lester commentedon Feb 2, 2024
@jlthorel thank you for saving us as well! You are the best!!!
We had issues recently with SSO on heroku where our ACS was failing. We isolated it to python3-saml
validate_sign--> xmlsecxmlsec.tree.add_ids(elem, ["ID"])... thank you ❤️Daviazuos commentedon Feb 9, 2024
@jlthorel You saved my life!!
vpatov commentedon Feb 12, 2024
We had the same issue with our SAML SSO failing due to a seg fault, downgrading
lxmlresolved the issuequique commentedon Feb 21, 2024
OMG, this was driving me crazy: my SAML SSO was failing most of the times, but sometimes it did work 😠 .
Downgrading xml fixed the issue :-) Thanks a lot for the tip!!!
quique commentedon Feb 21, 2024
I couldn't find any bug report about this, so I just submitted one:
https://bugs.launchpad.net/lxml/+bug/2054606
andpena commentedon Mar 15, 2024
Thank you very much! This solution worked for me too.
quique commentedon May 2, 2024
The folks at lxml closed the report.
They consider it is a third party issue (ie, that the problem lies in xmlsec).
quique commentedon May 2, 2024
I believe commit ee9fbd0 by @jonathangreen avoids the segfault without any error message, and emits instead an exception ("lxml & xmlsec libxml2 library version mismatch").
However, it's still not clear to me what we should do to avoid it.
jonathangreen commentedon May 2, 2024
Hi @quique. My comment here gives some context #316 (comment) that might be helpful.
Basically to avoid the issue, either both
lxmlandxmlsecshould be installed from wheels, or should both be installed with--no-binaryset.The most recent release for
xmlsecsupplies wheels for most platforms, so updating to the most recent and making sure that it it installed from via a wheel is probably the easiest fix.quique commentedon May 3, 2024
@jonathangreen Thank you for your helpful comment!
Unfortunately it seems I'm quite thick today, because I am unable to make it work.
This is what I do:
If I understand it correctly, this way both
lxmlandxmlsecare installed from wheels, but I stil get a segmentation fault.This is what I see:
Any hint? Thank you!