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

Segfault, "No protocol specified" #35

Closed
ChristianRomberg opened this issue Jan 23, 2018 · 13 comments
Closed

Segfault, "No protocol specified" #35

ChristianRomberg opened this issue Jan 23, 2018 · 13 comments

Comments

@ChristianRomberg
Copy link
Contributor

Hi, I recently upgraded to Ubuntu 17.10 which uses Wayland instead of X11. cnping used to work before the upgrade, and now it doesn't. I freshly installed cnping from source to make sure I got the latest version, but it segfaults after saying "No protocol specified". Screenshot below.
screenshot from 2018-01-23 20-53-50

If you need anything, my grahpics settings etc, just leave a comment. Thanks!

@ChristianRomberg
Copy link
Contributor Author

Done a little debugging (courtesy of some printf) and it turns out XOpenDisplay(NULL) returns NULL. Not sure why, I thought XWayland would take care of it. Other X Windows (such as xeyes) work fine.

@ChristianRomberg
Copy link
Contributor Author

Ok. Got it. It's the setuid causing trouble. If I follow the instructions outlined here, everything works.

@cnlohr
Copy link
Member

cnlohr commented Jan 24, 2018

hmm, that is annoying it doesn't "just" work. But there's really no other way around it

@ChristianRomberg
Copy link
Contributor Author

I guess one way to deal with it would be to build 2 seperate applications, one with elevated permissions (which does the pinging) and one for plotting. Having to execute those commands before using this awesome program is just a pita

@cnlohr
Copy link
Member

cnlohr commented Jan 24, 2018

indeed! Sounds like something that needs to be complained about for the people XWayland ppl to address.

@dreua
Copy link
Member

dreua commented Jan 25, 2018

Maybe we should try using capabilities instead of setuid before doing anything more complex. See this article for a short overview: https://www.insecure.ws/linux/getcap_setcap.html

@ChristianRomberg
Copy link
Contributor Author

That works brilliantly! Thanks. If there aren't any major drawbacks to this I'm gonna do a PR

@cnlohr
Copy link
Member

cnlohr commented Jan 25, 2018

@dreua thank you so much for that. I had no idea it existed.

@dreua
Copy link
Member

dreua commented Feb 9, 2018

I experienced some really strange behavior when upgrading from the old (setuid) to the new (getcap) version:

  1. On linuxinstall the file /usr/local/bin/cnping is overwritten but the setuid-bit from the file being previously at that location (from the old version) is for some reason (bug or feature in cp?) still present in the new version.
  2. Now my cnping has both, the setuid bit and the cap_net_raw capability, and I get the same "No protocol specified" error as @ChristianRomberg. If I remove either the setuid bit or the cap_net_raw capability it works fine.

Can someone explain 1 or 2? Does someone experience the same?

This happens both on Fedora 26 and 27 in X11 mode. (Wayland is available but not activated.)

Proposed workaround: Add sudo rm /usr/local/bin/cnpingor sudo chmod -s /usr/local/bin/cnpingto the Makefile.

@cnlohr cnlohr reopened this Feb 9, 2018
@cnlohr
Copy link
Member

cnlohr commented Feb 9, 2018

My recommendation would be to do the first option of removing cnping.

@ChristianRomberg
Copy link
Contributor Author

We could just install it with the coreutils install which clears all the permissions and file flags. Its really only a cosmetic difference which archieves the same goal of removing the setuid.

@ChristianRomberg
Copy link
Contributor Author

Kinda odd though that removing the file capability fixes the issue for @dreua . Not sure whats up with that. But can you confirm that it works when you give it only the capability and not the setuid-flag?

@dreua
Copy link
Member

dreua commented Feb 11, 2018

Yes, it works fine with the capability only and with the setuid bit only, but both is a problem. (I have no clue why, I guess it's a bug in Fedora.) I just tried your PR and it works fine for me, thanks 👍

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

No branches or pull requests

3 participants