-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-111178: Generate correct signature for most self converters #128447
gh-111178: Generate correct signature for most self converters #128447
Conversation
erlend-aasland
commented
Jan 3, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: UBSan: Calling a function through pointer to incorrect function type is undefined behavior #111178
This comment was marked as resolved.
This comment was marked as resolved.
WDYT, @picnixz? |
I think this is what I had in mind. I'm no more on my dev session but I'll pick your branch, create a branch with all my known UBSan fixes branches and then I'll need to manually address the remaining ones. AFAICT, no new |
Yeah, this PR only makes sure we're using PyObject pointers in the PyMethodDef "entries". No new |
I'll leave this in draft so we don't create a review rush. |
Friendly ping, @picnixz! |
Sorry for the late reply. I checked what I still need to do for other UBSan failures and there are quite a lot of places to fix. Here's what I can suggest: we first merge your PR and then we continue fixing the rest of UBSan failures. I wanted to delay this PR until the other failures are patched but there just too many errors in the clang output that it's hard to know where to start. So, I think we can first fix those now and then continue the work normally. I'll also tag @vstinner, @encukou and @ZeroIntensity who worked with me on that matter to hear their thoughts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, let's not delay this step.
Not sure if this is meant to be covered by this PR but: static PyObject *
list_append(PyListObject *self, PyObject *object)
{
PyObject *return_value = NULL;
Py_BEGIN_CRITICAL_SECTION(self);
return_value = list_append_impl((PyListObject *)self, object);
Py_END_CRITICAL_SECTION();
return return_value;
} has not been changed. |
Also, the subsequent casts: #define PY_LIST_CLEAR_METHODDEF \
{"clear", (PyCFunction)py_list_clear, METH_NOARGS, py_list_clear__doc__}, for static PyObject *
py_list_clear(PyObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
Py_BEGIN_CRITICAL_SECTION(self);
return_value = py_list_clear_impl((PyListObject *)self);
Py_END_CRITICAL_SECTION();
return return_value;
} are not needed but I don't know if it's possible to only remove the cast for the "fixed" methods or not. |
Correct, @picnixz, I don't think this is a complete solution. But these kinds of changes have a huge impact. It is pretty easy to validate this change, for example, but if we bake in another Argument Clinic change, it will be harder to validate the generated output. IMO, it is better to address this in a follow-up PR. |
Sure! I just wanted to be sure that you knew about this. But yes, otherwise I validate the current change (sorry for not having said it explicitly). |
@erlend-aasland We're having some CI failures now but I think it's because main wasn't merged recently and clinic not regen. |
Hm, yeah I guess we should've synced it before merging. |
Do you want to make a patch? (I can also do it if you don't have the time now) |
Yes, I'm creating an amendment now. Compiling ... 🤖 🤖 🤖 |
Amendment up: #129060. |
Nice enhancement, thanks. |