-
Notifications
You must be signed in to change notification settings - Fork 405
snapct: switch to tcp-based ping #8657
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -351,9 +351,10 @@ static ulong | |
| rlimit_file_cnt( fd_topo_t const * topo FD_PARAM_UNUSED, | ||
| fd_topo_tile_t const * tile ) { | ||
| ulong cnt = 1UL + /* stderr */ | ||
| 1UL; /* logfile */ | ||
| 1UL + /* logfile */ | ||
| 1UL; | ||
| if( download_enabled( tile ) ) { | ||
| cnt += 1UL + /* ssping socket */ | ||
| cnt += FD_SSPING_FD_CNT + /* ssping socket */ | ||
| 2UL + /* dirfd + full snapshot download temp fd */ | ||
| tile->snapct.sources.servers_cnt; /* http resolver peer full sockets */ | ||
| if( tile->snapct.incremental_snapshots ) { | ||
|
|
@@ -375,8 +376,18 @@ populate_allowed_seccomp( fd_topo_t const * topo, | |
| FD_SCRATCH_ALLOC_INIT( l, scratch ); | ||
| fd_snapct_tile_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_snapct_tile_t), sizeof(fd_snapct_tile_t) ); | ||
|
|
||
| int ping_fd = download_enabled( tile ) ? fd_ssping_get_sockfd( ctx->ssping ) : -1; | ||
| populate_sock_filter_policy_fd_snapct_tile( out_cnt, out, (uint)fd_log_private_logfile_fd(), (uint)ctx->local_out.dir_fd, (uint)ctx->local_out.full_snapshot_fd, (uint)ctx->local_out.incremental_snapshot_fd, (uint)ping_fd ); | ||
| int min_ping_fd = INT_MAX; | ||
| int max_ping_fd = -1; | ||
| int ping_fds[ 256 ]; | ||
| if( download_enabled( tile ) ) { | ||
| ulong fd_cnt = fd_ssping_get_sockfds( ctx->ssping, ping_fds, 256UL ); | ||
| for( ulong i=0UL; i<fd_cnt; i++ ) { | ||
| min_ping_fd = fd_int_min( min_ping_fd, ping_fds[ i ] ); | ||
| max_ping_fd = fd_int_max( max_ping_fd, ping_fds[ i ] ); | ||
| } | ||
| } | ||
|
|
||
| populate_sock_filter_policy_fd_snapct_tile( out_cnt, out, (uint)fd_log_private_logfile_fd(), (uint)ctx->local_out.dir_fd, (uint)ctx->local_out.full_snapshot_fd, (uint)ctx->local_out.incremental_snapshot_fd, (uint)min_ping_fd, (uint)max_ping_fd ); | ||
| return sock_filter_policy_fd_snapct_tile_instr_cnt; | ||
| } | ||
|
|
||
|
|
@@ -385,7 +396,7 @@ populate_allowed_fds( fd_topo_t const * topo, | |
| fd_topo_tile_t const * tile, | ||
| ulong out_fds_cnt, | ||
| int * out_fds ) { | ||
| if( FD_UNLIKELY( out_fds_cnt<6UL ) ) FD_LOG_ERR(( "out_fds_cnt %lu", out_fds_cnt )); | ||
| if( FD_UNLIKELY( out_fds_cnt<255UL ) ) FD_LOG_ERR(( "out_fds_cnt %lu", out_fds_cnt )); | ||
|
||
|
|
||
| ulong out_cnt = 0; | ||
| out_fds[ out_cnt++ ] = 2UL; /* stderr */ | ||
|
|
@@ -400,7 +411,7 @@ populate_allowed_fds( fd_topo_t const * topo, | |
| if( FD_LIKELY( -1!=ctx->local_out.dir_fd ) ) out_fds[ out_cnt++ ] = ctx->local_out.dir_fd; | ||
| if( FD_LIKELY( -1!=ctx->local_out.full_snapshot_fd ) ) out_fds[ out_cnt++ ] = ctx->local_out.full_snapshot_fd; | ||
| if( FD_LIKELY( -1!=ctx->local_out.incremental_snapshot_fd ) ) out_fds[ out_cnt++ ] = ctx->local_out.incremental_snapshot_fd; | ||
| if( FD_LIKELY( download_enabled( tile ) ) ) out_fds[ out_cnt++ ] = fd_ssping_get_sockfd( ctx->ssping ); | ||
| if( FD_LIKELY( download_enabled( tile ) ) ) out_cnt += fd_ssping_get_sockfds( ctx->ssping, out_fds+out_cnt, out_fds_cnt-out_cnt ); | ||
|
|
||
| return out_cnt; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rlimit_file_cnt() now adds an extra bare
+ 1ULwith no comment or corresponding fd usage. This looks like an accidental overcount and makes it harder to audit the fd budget (especially now that FD_SSPING_FD_CNT is significant). Either remove this term or document exactly which file descriptor it is intended to account for.