Bugzilla – Bug 1054
python_plugin_unlink crashes with Python 3.12
Last modified: 2023-07-25 07:37:32 MDT
The Fedora rawhide and ELN builds of sudo are currently failing due to check_python_examples crashing during "make check" when built with Python 3.12: https://bugzilla.redhat.com/show_bug.cgi?id=2186412 (While that was reported with 1.9.13p2, the same occurs with 1.9.14p2.) This is currently preventing sudo from being built for the upcoming Fedora 39 and RHEL 10. You can see what's new in Python 3.12 here: https://docs.python.org/3.12/whatsnew/3.12.html
This appears to be a Python bug, it is a NULL dereference in the garbage collector code. Adding a check for a NULL prev in _PyObject_GC_UNTRACK works around the problem but I've no idea if it is correct.
I have committed a workaround for now until I am able to determine whether this is due to a reference counting issue in the sudo python plugin or a Python 3.12 bug.
Thanks, that allows the tests to proceed further, but another error occurs: https://kojipkgs.fedoraproject.org//work/tasks/7227/103717227/build.log Expectation failed at ./regress/testhelpers.c:139: actual is <<SudoGroupPlugin.__init__ was called with arguments: () [('args', ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin')), ('version', '1.0')] SudoGroupPlugin.__init__ returned result: <example_group_plugin.SudoGroupPlugin object> SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) SudoGroupPlugin.query returned result: <RC.REJECT: 0> >>: actual_content expected to be <<SudoGroupPlugin.__init__ was called with arguments: () [('args', ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin')), ('version', '1.0')] SudoGroupPlugin.__init__ returned result: <example_group_plugin.SudoGroupPlugin object> SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) SudoGroupPlugin.query returned result: 0 >>: expected_output Expectation failed at ./regress/testhelpers.c:279: actual is <<0>>: verify_content(stored_str, reference_path) not expected to be <<0>>: 0 Expectation failed at ./regress/check_python_examples.c:512: actual is <<0>>: verify_log_lines(expected_path("check_example_group_plugin_is_able_to_debug.log")) not expected to be <<0>>: 0 FAILED: testcase check_example_group_plugin_is_able_to_debug() at ./regress/check_python_examples.c:1543 The output of the plugin: The error output of the plugin: check_python_examples: 58 tests run, 1 errors, 98% success rate
There are other commits that fix that: https://www.sudo.ws/repos/sudo/rev/138957911238 https://www.sudo.ws/repos/sudo/rev/38f03683001d
Thank you, with all the plugins/python patches post-1.9.14p2 applied, the tests now pass in Fedora rawhide with Python 3.12. Can we expect a 1.9.14p3 with these patches sometime soon?
I found a better solution to the crash that doesn't involve leaking a reference and released sudo 1.9.14p3 with that change and the other Python 3.12 fixes.
Thanks, I have proposed the update for Fedora rawhide and the CI scratch builds were successful. All set from my end now.