The `grpc_channel_args` is retained on the Ruby object and used for recreating the channel after forking in
grpc_rb_channel_maybe_recreate_channel_after_fork(). Previously, the key for each argument was taken from a Ruby string directly, which could be invalidated if the Ruby string is modified or moved by the GC. Duplicate the string for the key instead, so we own it.
Reproducer in https://github.com/grpc/grpc/issues/35489
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes #35488
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35488 from Shopify:key-uaf
|
||
|---|---|---|
| .. | ||
| lib | ||
| protos | ||
| README.md | ||
| bad_usage_fork_test.rb | ||
| call_credentials_returning_bad_metadata_doesnt_kill_background_thread_test.rb | ||
| call_credentials_timeout_test.rb | ||
| channel_closing_client.rb | ||
| channel_closing_test.rb | ||
| channel_state_client.rb | ||
| channel_state_test.rb | ||
| client_memory_usage_client.rb | ||
| client_memory_usage_test.rb | ||
| echo_server.rb | ||
| end2end_common.rb | ||
| errors_load_before_grpc_lib_test.rb | ||
| fork_test.rb | ||
| fork_test_repro_35489.rb | ||
| forking_client_client.rb | ||
| forking_client_test.rb | ||
| gen_protos.sh | ||
| graceful_sig_handling_client.rb | ||
| graceful_sig_handling_test.rb | ||
| graceful_sig_stop_client.rb | ||
| graceful_sig_stop_test.rb | ||
| grpc_class_init_client.rb | ||
| grpc_class_init_test.rb | ||
| killed_client_thread_client.rb | ||
| killed_client_thread_test.rb | ||
| load_grpc_with_gc_stress_test.rb | ||
| logger_load_before_grpc_lib_test.rb | ||
| multiple_killed_watching_threads_test.rb | ||
| package_with_underscore_test.rb | ||
| prefork_postfork_loop_test.rb | ||
| prefork_without_using_grpc_test.rb | ||
| secure_fork_test.rb | ||
| sig_handling_client.rb | ||
| sig_handling_test.rb | ||
| sig_int_during_channel_watch_client.rb | ||
| sig_int_during_channel_watch_test.rb | ||
| simple_fork_test.rb | ||
| status_codes_load_before_grpc_lib_test.rb | ||
README.md
This directory contains some grpc-ruby end to end tests.
Each test here involves two files: a "driver" and a "client". For example, the "channel_closing" test involves channel_closing_driver.rb and channel_closing_client.rb.
Typically, the "driver" will start up a simple "echo" server, and then spawn a client. It gives the client the address of the "echo" server as well as an address to listen on for control rpcs. Depending on the test, the client usually starts up a "ClientControl" grpc server for the driver to interact with (the driver can tell the client process to do strange things at different times, depending on the test).
So far these tests are mostly useful for testing process-shutdown related situations, since the client's run in separate processes.
These tests are invoked through the "tools/run_tests/run_tests.py" script (the Rakefile doesn't start these).