Skip to content

Getting Segfault issue when login using SAML #389

@ahujarajesh

Description

@ahujarajesh

We are using onelogin for saml login via okta, recently we figured out after updating lxml == 5.0.0 we are seeing segmentation fault and python application crashes.

After downgrading version of lxml to 4.9.3 this issue resolves.

Here are the traces for your reference.

System Info:

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Python 3.10.12
python3-saml==1.16.0

dmesg logs:

Jan  2 15:07:25 ip-172-28-5-29 kernel: python3.10[14382]: segfault at c ip 00007f1d9751cce0 sp 00007f1d7a7f7c70 error 4 in libxml2.so.2.9.13[7f1d974d7000+153000] likely on CPU 3 (core 1, socket 0)
Jan  2 15:07:25 ip-172-28-5-29 kernel: Code: e0 04 49 03 45 00 8b 50 28 85 d2 0f 84 ec 00 00 00 49 83 7d 10 00 74 6c 48 89 c2 eb 0d 0f 1f 44 00 00 48 8b 12 48 85 d2 74 5a <48> 39 5a 08 75 f2 48 39 6a 10 75 ec 4c 39 62 18 75 e6 48 8b 42 20
Jan  2 15:07:25 ip-172-28-5-29 systemd[1]: webui.service: Main process exited, code=dumped, status=11/SEGV
Jan  2 15:07:25 ip-172-28-5-29 systemd[1]: webui.service: Failed with result 'core-dump'.
Jan  2 15:07:25 ip-172-28-5-29 systemd[1]: webui.service: Consumed 2min 48.996s CPU time.

PYTHONFAULTHANDLER=1:

Thread 0x00007f416effd640 (most recent call first):
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/process/plugins.py", line 514 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f416f7fe640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f416ffff640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418cff9640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418d7fa640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418dffb640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418e7fc640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418effd640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait 
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Current thread 0x00007f418f7fe640 (most recent call first): 
  File "/usr/local/lib/python3.10/dist-packages/onelogin/saml2/utils.py", line 826 in validate_sign
  File "/usr/local/lib/python3.10/dist-packages/onelogin/saml2/utils.py", line 48 in exceptfalse
  File "/usr/local/lib/python3.10/dist-packages/onelogin/saml2/response.py", line 305 in is_valid
  File "/usr/local/lib/python3.10/dist-packages/onelogin/saml2/auth.py", line 131 in process_response
  File "/efs/ubuntu/App/trunk/App/src/modsaml.py", line 29 in consume
  File "/home/ubuntu/App/trunk/App/src/webui.py", line 291 in wrsaml_consume
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpdispatch.py", line 54 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/lib/encoding.py", line 223 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cprequest.py", line 697 in _do_respond
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cprequest.py", line 638 in respond
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cprequest.py", line 604 in run
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 335 in run
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 236 in __init__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 423 in tail
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 104 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 184 in trap
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 166 in __init__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 148 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cpwsgi.py", line 435 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cptree.py", line 168 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/_cptree.py", line 302 in __call__
  File "/usr/local/lib/python3.10/dist-packages/cheroot/wsgi.py", line 136 in respond
  File "/usr/local/lib/python3.10/dist-packages/cheroot/server.py", line 1077 in respond
  File "/usr/local/lib/python3.10/dist-packages/cheroot/server.py", line 1287 in communicate
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 120 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f418ffff640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f419cbfd640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/usr/local/lib/python3.10/dist-packages/cheroot/workers/threadpool.py", line 110 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f419d3fe640 (most recent call first):
  File "/usr/lib/python3.10/selectors.py", line 469 in select
  File "/usr/local/lib/python3.10/dist-packages/cheroot/connections.py", line 102 in select
  File "/usr/local/lib/python3.10/dist-packages/cheroot/connections.py", line 233 in _run
  File "/usr/local/lib/python3.10/dist-packages/cheroot/connections.py", line 198 in run
  File "/usr/local/lib/python3.10/dist-packages/cheroot/server.py", line 1814 in serve
  File "/usr/local/lib/python3.10/dist-packages/cheroot/server.py", line 1841 in start
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/process/servers.py", line 225 in _start_http_thread
  File "/usr/lib/python3.10/threading.py", line 953 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f419dbff640 (most recent call first):
  File "/home/ubuntu/App/trunk/App/src/webui.py", line 728 in _log_compact_thread
  File "/usr/lib/python3.10/threading.py", line 953 in run
  File "/usr/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib/python3.10/threading.py", line 973 in _bootstrap

Thread 0x00007f41a413f1c0 (most recent call first):
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/process/wspbus.py", line 376 in wait
  File "/usr/local/lib/python3.10/dist-packages/cherrypy/process/wspbus.py", line 336 in block
  File "/home/ubuntu/App/trunk/App/src/webui.py", line 254 in main
  File "/home/ubuntu/App/trunk/App/src/webui.py", line 1046 in <module>

Extension modules: lxml._elementpath, lxml.etree, xmlsec, charset_normalizer.md, _cffi_backend, MySQLdb._mysql (total: 6)
Segmentation fault (core dumped)

GDB:

Thread 5 "python3.10" received signal SIGBUS, Bus error.
[Switching to Thread 0x7ffff09fd640 (LWP 18581)]
0x00007ffff61e6bf0 in xmlDictLookup () from /lib/x86_64-linux-gnu/libxml2.so.2
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) 
Continuing.
Couldn't get registers: No such process.
(gdb) py-bt
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb)
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) 
Unable to locate python frame
Couldn't get registers: No such process.
(gdb) py-bt[Thread 0x7fffc2ffd640 (LWP 18606) exited]
[Thread 0x7fffc37fe640 (LWP 18590) exited]
[Thread 0x7fffc3fff640 (LWP 18589) exited]
[Thread 0x7fffe0ff9640 (LWP 18588) exited]
[Thread 0x7fffe17fa640 (LWP 18587) exited]
[Thread 0x7fffe1ffb640 (LWP 18586) exited]
[Thread 0x7fffe27fc640 (LWP 18585) exited]
[Thread 0x7fffe2ffd640 (LWP 18584) exited]
[Thread 0x7fffe37fe640 (LWP 18583) exited]
[Thread 0x7fffe3fff640 (LWP 18582) exited]
[Thread 0x7ffff09fd640 (LWP 18581) exited]
[Thread 0x7ffff11fe640 (LWP 18580) exited]
[Thread 0x7ffff7e7d1c0 (LWP 18483) exited]
[Thread 0x7ffff19ff640 (LWP 18487) exited]
[New process 18483]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions