Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
U userhosts
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • nexedi
  • userhosts
  • Merge requests
  • !2

Merged
Created Mar 13, 2018 by Vincent Pelletier@vpelletierOwner

Fix segfaults when in concurrence with other constructors

  • Overview 1
  • Commits 2
  • Changes 2

Fix segfaults found when running inkscape, when trying to make test nodes use userhosts.

Also fixes segfaults when running ls, discoverd while debugging the former problem, when ls is linked against libselinux.

Cons: an extra if in regular codepath. Expected to have negligible overhead compared to the I/Os happening during/after open (we are fetching a pointer just a bit earlier than before), and a potential branch misprediction (which should be trivial for branch predictor to get right anyway).

Pros: we do not depend on gcc anymore !

Possible refinements:

  • Maybe adding some branch prediction hints, but I doubt this is worth the code complexity, CPU architecture and compiler dependencies.
  • Maybe macro-ing the ifs. Does not look too bad the current way, so I don't think it would gain much.

Also, accidentally re-debugging the issue which led @kazuhiko to replace -fPIE by -fPIC, I came to the conclusion that it is not wise to rely on FILE *stderr to begin with, because we can be called very early in process initialisation and stderr is a global initialised by the libc. So it seems better to only rely on low-level file descriptors instead, and AFAIK fprintf was only used out of habit and not as a specific choice. Anyway, I am not putting the -fPIE-to--fPIC change into question, as I do not understand clearly now the implications of one vs the other (gcc manpage say -fPIE is like -fPIC but code cano only linked into an executable... whatever that means. Other places mention the ability to intercept library calls in PIC but not in PIE, but again it's not clear what looses the ability: an extra preloaded library or our own code ?).

/cc @jerome (bug reporter), @jm for review

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: master
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7