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

Linux: UnixCmsg: Don't deduce maximum cmsg size from data size #60

Closed
wants to merge 1 commit into from

Conversation

@eddyb
Copy link
Contributor

eddyb commented Apr 1, 2016

@antrik committed 10f4032:

Just because we allocate a generous receive buffer for auxilllary data,
doesn't mean that a message can't use the space for other things when it
doesn't actually carry that amount of auxillary data.

In fact, there is no reason to expect every message we receive to have
auxillary data at all -- so let's just allocate a data buffer matching
the total maximal receive size. This will enable some optimisations to
be implemented; and it simplifies the code too.

Note that the extra space is not used yet, until the sender side is
adapted to actually send larger messages making use of the extra space.
(Or even messages without auxillary data.)

This also fixes servo/servo#10260, but unlike #59, it's not just a hack.
I've put this up as a PR because @antrik might not get to it for a few days.
cc @Manishearth @pcwalton

Just because we allocate a generous receive buffer for auxilllary data,
doesn't mean that a message can't use the space for other things when it
doesn't actually carry that amount of auxillary data.

In fact, there is no reason to expect every message we receive to have
auxillary data at all -- so let's just allocate a data buffer matching
the total maximal receive size. This will enable some optimisations to
be implemented; and it simplifies the code too.

Note that the extra space is not used yet, until the sender side is
adapted to actually send larger messages making use of the extra space.
(Or even messages without auxillary data.)
@Manishearth
Copy link
Member

Manishearth commented Apr 1, 2016

This works for me; I'm not getting any IPC related crashes.

@antrik
Copy link
Contributor

antrik commented Apr 1, 2016

If this can wait till later today or maybe tomorrow, I'd put up a more polished PR: with a reworked commit message mentioning the bug fix; and adding a test case... It's not too important though, if this fix is urgent.

@antrik
Copy link
Contributor

antrik commented Apr 2, 2016

Please close in favour of #61

@emilio emilio closed this Apr 2, 2016
bors-servo added a commit that referenced this pull request Apr 6, 2016
Linux: Fix receive for message sizes close to packet size

Fixes servo/servo#10260

This supersedes #60 -- which is basically the same change; but now we have a test case, and an improved commit message. (Pointing out the bug fix; and also fixing a very confusing typo in the title...)

The extra commit does some refactoring necessary for the new test case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.