coreos / coreos/go-systemd

Socket activation logic lacks error checking

Open
#405 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.7k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

In https://github.com/coreos/go-systemd/blob/f5f8d59a116b1ca501dd87cdb28f6ce89ccf58dc/activation/files_unix.go#L66 the return value of os.NewFile should be checked before files is changed. It can fail if the environment variables don't match the file descriptor table, e.g. LISTEN_FDS is much larger than the number of open files. The current logic would force consumers of the interface to check for this condition or run into mysterious panics in a completely unrelated code. If os.NewFile fails, just returning nil might be reasonable, even if it means close-on-exec is set on some file descriptors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open activation/files_unix.go at the referenced line and trace how os.NewFile is used before files is changed. Reproduce the LISTEN_FDS mismatch case described in the issue, then verify that the failure is handled without leaving consumers exposed to a later panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.