-
Notifications
You must be signed in to change notification settings - Fork 22
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
Inconsistent ownership semantics of kdump_set_attr #81
Comments
Hi Brandon, FWIW the object model in libkdumpfile is half-baked, unfortunately. Refcounting was added when it became necessary for the Python bindings, and it may not work properly. The goal is to make the API easy to use, and this is why In short, leaking a reference on failure is a bug. Thank you for a couple of places where that happens. I'll have a look at this tomorrow (European time). |
Status update: I haven't forgotten about this issue, but it turns out that references are leaked in many more places. I'm trying to come up with a fix that would not clutter the sources with excessive decref's. |
Hi Petr,
Omar & I were looking at
kdump_set_attr(ctx, "linux.vmcoreinfo.raw", &attr)
and trying to determine the correct error handling behavior. See this thread on my PR. The original context there is that I included an extrafree()
which was definitely wrong on my part. But that led to the following question:When
kdump_set_attr()
fails, does the value need to be decref'd? There seem to be two cases:set_attr()
which says that any failure also discards and decref's the new value.set_attr()
, for example here inkdump_set_attr()
or here incheck_set_attr()
, then the attribute would be left untouched.So either we leak the attribute in an error or we double-free / underflow the reference count. Given those choices, I tend to prefer the leak, but ideally we wouldn't need to choose. Does my analysis look right here? If so, I'm happy to send a PR or if you prefer to fix it up yourself, that's fine as well.
The text was updated successfully, but these errors were encountered: