Skip to content

Set SOCK_CLOEXEC for sockets (hardcoded via poco update) - #21695

Merged
kitaisreal merged 1 commit into
ClickHouse:masterfrom
azat:O_CLOEXEC-for-listen-sockets
Mar 15, 2021
Merged

kitaisreal merged 1 commit into
ClickHouse:masterfrom
azat:O_CLOEXEC-for-listen-sockets

Conversation

@azat

@azat azat commented Mar 13, 2021 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Set SOCK_CLOEXEC for sockets (hardcoded via poco update)

Detailed description / Documentation draft:
Found this in 1, multiple processes has LISTEN socket for :9000:

[Detaching after fork from child process 184152]
...
Cannot get server pid with {}, got {}: {} lsof -i tcp:9000 -s tcp:LISTEN -Fp | awk '/^p[0-9]+$/{print substr($0, 2)}' b'301\n184152\n' invalid literal for int() with base 10: b'301\n184152\n'

But the major idea is that parent process should not export any file
descriptors to childrens, otherwise this may create security and other
breaches (like extra pipe endpoints, ...)

Refs: ClickHouse/poco#35
Follow-up-for: #9174

@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 13, 2021
@azat azat changed the title Set O_CLOEXEC for listen sockets (via poco update) Set O_CLOEXEC for sockets (via poco update) Mar 13, 2021
@azat
azat force-pushed the O_CLOEXEC-for-listen-sockets branch from fd75731 to f3c4179 Compare March 13, 2021 07:23
@azat azat changed the title Set O_CLOEXEC for sockets (via poco update) Set O_CLOEXEC for sockets (hardcoded via poco update) Mar 13, 2021
@azat
azat force-pushed the O_CLOEXEC-for-listen-sockets branch from f3c4179 to 1f5bf5a Compare March 13, 2021 07:23
@robot-clickhouse robot-clickhouse added the submodule changed At least one submodule changed in this PR. label Mar 13, 2021
@azat azat changed the title Set O_CLOEXEC for sockets (hardcoded via poco update) Set SOCK_CLOEXEC for sockets (hardcoded via poco update) Mar 13, 2021
Found this in [1]:

    [Detaching after fork from child process 184152]
    ...
    Cannot get server pid with {}, got {}: {} lsof -i tcp:9000 -s tcp:LISTEN -Fp | awk '/^p[0-9]+$/{print substr($0, 2)}' b'301\n184152\n' invalid literal for int() with base 10: b'301\n184152\n'

But the major idea is that parent process should not export any file
descriptors to childrens, otherwise this may create security and other
breaches (like extra pipe endpoints, ...)

  [1]: https://clickhouse-test-reports.s3.yandex.net/21511/d7d9638ceb6bd702f34a88ee54f8f83197e90af5/stress_test_(address).html#fail1

Refs: ClickHouse/poco#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants