Skip to content

Commit 7a898dd

Browse files
committed
config: fix use after free error
The doc strings in configuration entries cannot be temporaries (e.g. they cannot be a fmt::format(...)) string because the configuration structures store std::string_view. This will lead to sanitizer error like this: ``` 819955: ==819957==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000011fc0 at pc 0x5603f697f78a bp 0x7fd04ae85a90 sp 0x7fd04ae85a88 819955: READ of size 1 at 0x611000011fc0 thread T0 819955: #0 0x5603f697f789 in std::__1::pair<char const*, char*> std::__1::__uninitialized_copy_n<char, char const*, unsigned long, char*, std::__1::__unreachable_sentinel>(char const*, unsigned long, char*, std::__1::__unreachable_sentinel) /home/nwatkins/src/redpanda/vbuild/llvm/install/bin/../include/c++/v1/__memory/uninitialized_algorithms.h:77:51 ... 819955: redpanda-data#14 0x5603f6b9f37f in seastar::basic_sstring<char, unsigned int, 15u, true> ssx::sformat<std::__1::basic_string_view<char, std::__1::char_traits<char>>&, config::base_property const&, std::__1::basic_string_view<char, std::__1::char_traits<char>> const&>(fmt::v8::basic_format_string<char, fmt::v8::type_identity<std::__1::basic_string_view<char, std::__1::char_traits<c har>>&>::type, fmt::v8::type_identity<config::base_property const&>::type, fmt::v8::type_identity<std::__1::basic_string_view<char, std::__1::char_traits<char>> const&>::type>, std::__1::basic_string_view<char, std::__1::char_traits<char>>&, config::base_property const&, std::__1::basic_string_view<char, std::__1::char_traits<char>> const&) /home/nwatkins/src/redpanda/src/v/ssx/s format.h:62:5 819955: redpanda-data#15 0x5603f673b6c9 in auto auto application::hydrate_config(boost::program_options::variables_map const&)::$_11::operator()<config::configuration>(std::__1::basic_string_view<char, std::__1::char_traits<char>>, config::configuration const&) const::'lambda'(config::configuration const&)::operator()<config::base_property>(config::configuration const&) const /home/nwatki ns/src/redpanda/src/v/redpanda/application.cc:533:15 ``` Signed-off-by: Noah Watkins <[email protected]>
1 parent 7665c32 commit 7a898dd

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/v/config/configuration.cc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,24 +1568,18 @@ configuration::configuration()
15681568
, kafka_throughput_limit_node_in_bps(
15691569
*this,
15701570
"kafka_throughput_limit_node_in_bps",
1571-
fmt::format(
1572-
"Node wide throughput ingress limit - maximum kafka traffic throughput "
1573-
"allowed on the ingress side of each node, in bytes/s. Default is no "
1574-
"limit. Effective minimum is 1bps*#cores. Effective maximum is "
1575-
"{}bps*#cores.",
1576-
bottomless_token_bucket::max_quota),
1571+
"Node wide throughput ingress limit - maximum kafka traffic throughput "
1572+
"allowed on the ingress side of each node, in bytes/s. Default is no "
1573+
"limit.",
15771574
{.needs_restart = needs_restart::no, .visibility = visibility::user},
15781575
std::nullopt,
15791576
{.min = 1})
15801577
, kafka_throughput_limit_node_out_bps(
15811578
*this,
15821579
"kafka_throughput_limit_node_out_bps",
1583-
fmt::format(
1584-
"Node wide throughput egress limit - maximum kafka traffic throughput "
1585-
"allowed on the egress side of each node, in bytes/s. Default is no "
1586-
"limit. Effective minimum is 1bps*#cores. Effective maximum is "
1587-
"{}bps*#cores.",
1588-
bottomless_token_bucket::max_quota),
1580+
"Node wide throughput egress limit - maximum kafka traffic throughput "
1581+
"allowed on the egress side of each node, in bytes/s. Default is no "
1582+
"limit.",
15891583
{.needs_restart = needs_restart::no, .visibility = visibility::user},
15901584
std::nullopt,
15911585
{.min = ss::smp::count})

0 commit comments

Comments
 (0)