Skip to content
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

[NetBSD] cmdline() can raise MemoryError #1526

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

krytarowski
Copy link
Contributor

  • stop including sys/user.h for NetBSD
  • Fix psutil_get_cmd_args

Do not overallocate the buffer prompting for KERN_ARGMAX.
It also fixes the code as KERN_ARGMAX was received into a size_t
type, while kernel returned int. It caused argmax to contain
garbage and allocation was randomly crashing with new jemalloc in
the basesystem.

New code prompts for exact buffer size before allocation and
stores argv[] inside it.

Bug investigated by Leonardo Taccari.
This header was removed from the OS as it was empty.
@giampaolo
Copy link
Owner

What was the problem with cmdline? It got truncated?

@krytarowski
Copy link
Contributor Author

malloc(3) returned NULL for buffer of size with garbage

@iamleot
Copy link

iamleot commented Jun 8, 2019 via email

@krytarowski
Copy link
Contributor Author

I plan to submit implementation of missing features for NetBSD, but I will do it with 1 PR after another.

@giampaolo giampaolo merged commit 1087e24 into giampaolo:master Jun 11, 2019
@giampaolo
Copy link
Owner

Thanks, merged.

I plan to submit implementation of missing features for NetBSD, but I will do it with 1 PR after another.

Sounds sweet. I am looking forward to that.

@giampaolo giampaolo changed the title NetBSD fixes [NetBSD] cmdline() can raise MemoryError Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants