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

[networkd] Assertion '!(msg.msg_flags & MSG_TRUNC)' failed #2457

Closed
gdamjan opened this issue Jan 28, 2016 · 12 comments
Closed

[networkd] Assertion '!(msg.msg_flags & MSG_TRUNC)' failed #2457

gdamjan opened this issue Jan 28, 2016 · 12 comments
Labels
bug 🐛 Programming errors, that need preferential fixing network
Milestone

Comments

@gdamjan
Copy link
Contributor

gdamjan commented Jan 28, 2016

systemd compiled from git (b304283) (Arch AUR package)
the system is a libvirt/kvm archlinux guest. It has a single ens5 interface set to use DHCP (just [Network] DHCP=yes).

networkd crashes with:

Jan 28 07:34:26 arch-uefi-test systemd[1]: Starting Network Service...
Jan 28 07:34:26 arch-uefi-test systemd-networkd[10140]: ens5: Gained IPv6LL
Jan 28 07:34:26 arch-uefi-test systemd-networkd[10140]: Enumeration completed
Jan 28 07:34:26 arch-uefi-test systemd[1]: Started Network Service.
Jan 28 07:34:26 arch-uefi-test systemd-networkd[10140]: ens5: Could not drop address: No such process
Jan 28 07:34:26 arch-uefi-test systemd-networkd[10140]: Assertion '!(msg.msg_flags & MSG_TRUNC)' failed at src/libsystemd-network/sd-ndisc.c:536, function ndisc_router_advertisment_recv(). Aborting.
Jan 28 07:34:26 arch-uefi-test systemd[1]: systemd-networkd.service: Main process exited, code=killed, status=6/ABRT
Jan 28 07:34:26 arch-uefi-test systemd[1]: systemd-networkd.service: Unit entered failed state.
@zonque zonque added the network label Jan 28, 2016
@poettering poettering added the bug 🐛 Programming errors, that need preferential fixing label Jan 28, 2016
@poettering
Copy link
Member

@teg, any idea?

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 10, 2016

logging out len and buflen before that assert they are both 74.

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 10, 2016

But!
I've set buflen to a fixed 1500, len (from recvmsg) now is 144 bytes, and the assert no longer applies. it seems that the r = ioctl(fd, FIONREAD, &buflen); doesn't return the proper value??

@poettering
Copy link
Member

Strange... that would indicate a kernel bug...

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 10, 2016

I tried both 4.4.1 and 4.1.17 (arch kernels) same behaviour. isn't it possible for data to arrive after FIONREAD is called?

@poettering
Copy link
Member

well, but it's a datagram interface... datagrams should not change their size just because more datagrams have been received...

But maybe the local queuing drops datagrams for some reason (after all, they are allowed to do that, it's IP). and hence between FIONREAD and recvmsg() the packet we are about to process changes...

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 10, 2016

a quick workaround would be to use a uint8_t buffer[BUFFER_MAX_SIZE]; on the stack to read into instead of the dynamically malloc/cleanup_free heap variable?

(edit) … or malloc enough bytes for an RA.

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 15, 2016

Any ideas? I will send a pull request to just malloc a buffer of 2048, it seem the better option than the current.

ps. there are no 74 byte icmp6 datagrams on the network, only 144 byte ones (checked with sudo tcpdump -i bridge0 -nv icmp6).

@teg
Copy link
Contributor

teg commented Feb 15, 2016

Thanks for the report. This seems really odd. I'll have a look.

@teg
Copy link
Contributor

teg commented Feb 15, 2016

how reproducible is this for you? if you add logging to record every successful packet, does it get the wrong size every time, or just some of the time?

@gdamjan
Copy link
Contributor Author

gdamjan commented Feb 15, 2016

fully reproducible
I get the same thing all the time

@poettering
Copy link
Member

@gdamjan could you check if the patch in #2626 fixes the problem for you?

poettering added a commit to poettering/systemd that referenced this issue Feb 16, 2016
@poettering poettering added this to the v230 milestone Feb 16, 2016
floppym pushed a commit to gentoo/systemd that referenced this issue Mar 5, 2016
mischief pushed a commit to mischief/systemd that referenced this issue Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing network
Development

No branches or pull requests

4 participants