Skip to content

Commit

Permalink
add more suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Feb 16, 2025
1 parent 4d0c707 commit c6bde7b
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 67 deletions.
184 changes: 181 additions & 3 deletions .github/workflows/run_sanitizers_undefined.suppressions
Original file line number Diff line number Diff line change
@@ -1,9 +1,187 @@
## See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
## See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
## Most of the supressed functions here use asserts, that in turn use an indirection through an interface. TODO: if that is solved, most of these can be removed.
## Usually they contain a __test_ in their name, but not always (see the x.ttf ones like vlib/x/ttf/ttf_test.v ).
## TODO: extract the common part of the assertions to a VDO_ function (1 for pass and 1 for failure), so that they can be whitelisted here just once.
function:map_exists
function:map_get
function:IError_str

shift-exponent:math__bits__rotate_left_64
shift-exponent:math__bits__div_64
function:math__big__Integer_general_radix_str
function:math__big__Integer_div_mod_internal
function:math__bits__test_bits
function:math__bits__test_div_64_edge_cases
function:math__test_nan

alignment:rand__read_64
function:rand__internal_ulid_at_millisecond
function:rand__internal_string_from_set
function:rand__internal_uuid_v4
function:rand__deinit
## needed for tests; TODO: move the test specific setup code into its own separate VDO_tests function, so only it can be added here
function:main
function:rand__read_internal
function:rand__read_64
function:rand__PRNG_f64

function:rand__cuid2__test_cuid2

function:sync__pool__process_in_thread
function:sync__Once_do_slow_with_param

function:v__type_resolver__TypeResolver_resolve_fn_generic_args
function:v__type_resolver__TypeResolver_unwrap_generic_expr
function:v__type_resolver__TypeResolver_get_type

## these have asserts in them, and trigger due to the used indirection; TODO: remove them, when a more general solution is found for all interfaces
function:x__ttf__TTF_File_get_glyph_offset
function:x__ttf__TTF_File_get_horizontal_metrics
function:x__ttf__TTF_File_glyph_count
function:x__ttf__TTF_File_read_glyph
function:x__ttf__TTF_File_read_simple_glyph
function:x__ttf__TTF_File_read_kern_table
function:x__ttf__TTF_File_read_hhea_table
function:x__ttf__TTF_File_read_cmap_table
function:x__ttf__TTF_File_read_name_table
function:x__ttf__TTF_File_read_head_table
function:x__ttf__TTF_File_read_offset_tables

function:net__unix__select_deadline
function:net__select_deadline
function:net__socks__test_parse_ipv4
function:net__http__download_file_with_progress
function:net__http__download_progres_cb
function:net__http__check_headers
function:net__http__test_str
function:net__http__test_int
function:net__http__test_is_valid
function:net__http__test_is_error
function:net__http__test_is_success
function:net__http__test_parse_response_with_weird_cookie
function:net__http__test_parse_response_with_cookies
function:net__http__test_parse_response
function:net__http__test_response_bytestr_1
function:net__http__test_response_bytestr_2
function:net__http__test_parse_large_body
function:net__http__test_multipart_form_body
function:net__http__test_parse_multipart_form2
function:net__http__test_parse_request_no_headers
function:net__http__test_parse_multipart_form
function:net__http__test_parse_form
function:net__http__test_parse_request_line
function:net__http__test_parse_request_body
function:net__http__test_parse_request_two_header_values
function:net__http__test_parse_request_no_headers
function:net__http__test_parse_request_two_headers
function:net__http__test_proxy_fields
function:net__http__test_proxy_headers
function:net__http__test_set_cookie
function:net__http__test_parse_headers
function:net__http__parse_headers_test
function:net__http__test_header_join
function:net__http__test_header_from_map
function:net__http__test_custom_header_from_map
function:net__http__test_render_coerce_canonicalize
function:net__http__test_render_canonicalize
function:net__http__test_render_version
function:net__http__test_coerce_canonicalize_custom
function:net__http__test_coerce_custom
function:net__http__test_coerce_canonicalize
function:net__http__test_coerce
function:net__http__test_custom_values
function:net__http__test_starting_with
function:net__http__test_get_custom
function:net__http__test_contains_custom
function:net__http__test_custom_header
function:net__http__test_delete_header
function:net__http__test_header_delete_not_existing
function:net__http__test_header_delete
function:net__http__test_header_set
function:net__http__test_header_get
function:net__http__test_header_adds_multiple
function:net__http__test_header_new
function:net__test_ip6_str
function:net__test_ip_str
function:net__test_sizes_unix
function:net__test_sizes_ipv4
function:net__test_sizes_ipv6
function:net__test_offsets_unix
function:net__test_offsets_ipv4
function:net__test_offsets_ipv6
function:net__test_sizes_unix_sun_path
function:net__test_diagnostics
function:net__test_ip_port
function:net__websocket__delete_client_cb
function:net__websocket__Server_listen
function:net__websocket__Server_serve_client
function:net__websocket__Server_parse_client_handshake
function:net__websocket__Client_listen
function:net__websocket__Client_send_message_event
function:net__websocket__Client_send_close_event
function:net__websocket__Client_debug_log
function:net__websocket__Client_connect

function:io__BufferedReader_fill_buffer
function:io__read_all

function:log__info
function:log__debug
function:log__warn
function:log__error
function:log__set_level
function:log__Log_log_stream
function:log__free_logger

function:picoev__Picoev_poll_once
function:picoev__Picoev_set_timeout
function:picoev__Picoev_update_events
function:picoev__test_if_all_file_descriptors_are_properly_initialized

function:vweb__tests__vweb_test_server__App_index
function:vweb__tests__vweb_test_server__start_in_background
function:vweb__RoutePair_test_param
function:veb__RoutePair_test_param
function:veb__test_load_files_translations

## needed for tests; TODO: move the test specific setup code into its own separate VDO_tests function, so only it can be added here
function:main

function:crypto__sha3__test_0_length_hash
function:crypto__sha3__test_0_length_xof
function:crypto__sha3__test_200_length_hash
function:crypto__sha3__test_200_length_xof

function:crypto__sha3__test_2_x_24_rounds_on_zero
function:crypto__sha3__test_stepping_functions_on_zero
function:crypto__sha3__test_zero_state
function:crypto__sha3__test_rho_offsets
function:crypto__sha3__test_to_from_bytes
function:crypto__sha3__test_round_constants

function:crypto__pem__test_decode_rfc1421
function:crypto__pem__test_decode
function:crypto__pem__test_encode_rfc1421
function:crypto__pem__test_encode

function:crypto__hmac__test_hmac_equal
function:crypto__hmac__test_hmac_sha3_224
function:crypto__hmac__test_hmac_sha3_256
function:crypto__hmac__test_hmac_sha3_384
function:crypto__hmac__test_hmac_sha3_512
function:crypto__hmac__test_hmac_blake3_256
function:crypto__hmac__test_hmac_blake2b_160
function:crypto__hmac__test_hmac_blake2b_256
function:crypto__hmac__test_hmac_blake2b_384
function:crypto__hmac__test_hmac_blake2b_512
function:crypto__hmac__test_hmac_blake2s_128
function:crypto__hmac__test_hmac_blake2s_160
function:crypto__hmac__test_hmac_blake2s_224
function:crypto__hmac__test_hmac_blake2s_256
function:crypto__hmac__test_hmac_sha512
function:crypto__hmac__test_hmac_sha384
function:crypto__hmac__test_hmac_sha256
function:crypto__hmac__test_hmac_sha224
function:crypto__hmac__test_hmac_sha1
function:crypto__hmac__test_hmac_md5

function:crypto__ed25519__internal__edwards25519__sc_reduce
function:crypto__ed25519__internal__edwards25519__sc_reduce
13 changes: 8 additions & 5 deletions .github/workflows/sanitized_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
VFLAGS: -cc clang
VFLAGS: -cc clang -cflags -fno-omit-frame-pointer
VJOBS: 1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions
VNATIVE_SKIP_LIBC_VV: 1
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
VFLAGS: -cc gcc
VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer
VJOBS: 1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_undefined.suppressions
VNATIVE_SKIP_LIBC_VV: 1
Expand Down Expand Up @@ -136,10 +136,11 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 300
env:
VFLAGS: -cc clang
VFLAGS: -cc clang -cflags -fno-omit-frame-pointer
VJOBS: 1
ASAN_OPTIONS: detect_leaks=1
LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions
VNATIVE_SKIP_LIBC_VV: 1
steps:
- uses: actions/checkout@v4
- name: Build V
Expand Down Expand Up @@ -169,6 +170,7 @@ jobs:
env:
VFLAGS: -cc msvc
VJOBS: 1
VNATIVE_SKIP_LIBC_VV: 1
steps:
- uses: actions/checkout@v4
- name: Build
Expand All @@ -190,10 +192,11 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 300
env:
VFLAGS: -cc gcc
VFLAGS: -cc gcc -cflags -fno-omit-frame-pointer
VJOBS: 1
ASAN_OPTIONS: detect_leaks=1
LSAN_OPTIONS: max_leaks=1:print_suppressions=0:suppressions=/home/runner/work/v/v/.github/workflows/run_sanitizers_leak.suppressions
VNATIVE_SKIP_LIBC_VV: 1
steps:
- uses: actions/checkout@v4
- name: Build V
Expand Down Expand Up @@ -221,7 +224,7 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 240
env:
VFLAGS: -cc clang -gc none
VFLAGS: -cc clang -gc none -cflags -fno-omit-frame-pointer
VJOBS: 1
VNATIVE_SKIP_LIBC_VV: 1
steps:
Expand Down
12 changes: 12 additions & 0 deletions vlib/builtin/cfns_wrapper.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub fn vmemcpy(dest voidptr, const_src voidptr, n isize) voidptr {
print_backtrace()
}
}
if n == 0 {
return dest
}
unsafe {
return C.memcpy(dest, const_src, n)
}
Expand All @@ -44,6 +47,9 @@ pub fn vmemmove(dest voidptr, const_src voidptr, n isize) voidptr {
$if trace_vmemmove ? {
C.fprintf(C.stderr, c'vmemmove dest: %p src: %p n: %6ld\n', dest, const_src, n)
}
if n == 0 {
return dest
}
unsafe {
return C.memmove(dest, const_src, n)
}
Expand All @@ -66,6 +72,9 @@ pub fn vmemcmp(const_s1 voidptr, const_s2 voidptr, n isize) int {
$if trace_vmemcmp ? {
C.fprintf(C.stderr, c'vmemcmp s1: %p s2: %p n: %6ld\n', const_s1, const_s2, n)
}
if n == 0 {
return 0
}
unsafe {
return C.memcmp(const_s1, const_s2, n)
}
Expand All @@ -85,6 +94,9 @@ pub fn vmemset(s voidptr, c int, n isize) voidptr {
print_backtrace()
}
}
if n == 0 {
return s
}
unsafe {
return C.memset(s, c, n)
}
Expand Down
6 changes: 5 additions & 1 deletion vlib/net/http/download_terminal_downloader.v
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ pub fn (mut d TerminalStreamingDownloader) on_chunk(request &Request, chunk []u8
d.past_time = now
d.past_received = already_received
ratio := f64(already_received) / f64(expected)
estimated := time.Duration(i64(f64(elapsed) / ratio))
res := f64(elapsed) / ratio
mut estimated := time.Duration(max_i64)
if f64(min_i64) < res && res < f64(max_i64) {
estimated = i64(res)
}
speed := f64(time.millisecond) * f64(already_received) / f64(elapsed)
elapsed_s := elapsed.seconds()
estimated_s := estimated.seconds()
Expand Down
14 changes: 8 additions & 6 deletions vlib/net/websocket/websocket_server.v
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ fn (mut s Server) setup_callbacks(mut sc ServerClient) {
}
}
// set standard close so we can remove client if closed
sc.client.on_close_ref(fn (mut c Client, code int, reason string, mut sc ServerClient) ! {
c.logger.debug('server-> Delete client')
lock sc.server.server_state {
sc.server.server_state.clients.delete(sc.client.id)
}
}, sc)
sc.client.on_close_ref(delete_client_cb, sc)
}

fn delete_client_cb(mut c Client, code int, reason string, mut sc ServerClient) ! {
c.logger.debug('server-> Delete client')
lock sc.server.server_state {
sc.server.server_state.clients.delete(sc.client.id)
}
}

// accept_new_client creates a new client instance for client that connects to the socket
Expand Down
Loading

0 comments on commit c6bde7b

Please sign in to comment.