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

Zero memory of sockaddr_un if abstract socket #220

Merged
merged 1 commit into from
Aug 15, 2016

Conversation

mitchellwrosen
Copy link
Contributor

An abstract socket is identified by the entire 108 byte sun_path. So, it's really only useful if the memory is zeroed out beforehand.

See man 7 unix

@kazu-yamamoto
Copy link
Collaborator

Sorry but I don't understand the original pokeSockAddr itself. Why is zeroMemory called only for Mac?

@mitchellwrosen
Copy link
Contributor Author

I don't know myself, but I just didn't touch it - the logic is now simply

if (darwin || abstract socket)
  zero_bytes

@vincenthz
Copy link

IIRC, it has to do with osx failing to use the SockAddr if the rest of the memory that is not used for the current type of SockAddr has not been zero'ed. no such requirements on other unixes.

(Obviously it would be best not to take this as face value, and test if that's still the case and add a comment in the code if true)

@kazu-yamamoto kazu-yamamoto merged commit 79e7fac into haskell:master Aug 15, 2016
@kazu-yamamoto
Copy link
Collaborator

kazu-yamamoto commented Aug 15, 2016

OK. LGTM. I have merged this.

@kazu-yamamoto
Copy link
Collaborator

Than you for your contribution!

eborden added a commit that referenced this pull request May 17, 2017
 * Zero memory of `sockaddr_un` if abstract socket
   [#220](#220)

 * Improving error messages
   [#232](#232)

 * Allow non-blocking file descriptors via `setNonBlockIfNeeded`
   [#242](#242)

 * Update config.{guess,sub} to latest version
   [#244](#244)

 * Rename `my_inet_ntoa` to avoid symbol conflicts
   [#228](#228)

 * Test infrastructure improvements
   [#219](#219)
   [#217](#217)
   [#218](#218)

 * House keeping and cleanup
   [#238](#238)
   [#237](#237)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants