[PATCH v5] eal: fix uncheck lcore role
Stephen Hemminger
stephen at networkplumber.org
Wed Aug 13 18:10:15 CEST 2025
On Thu, 7 Aug 2025 11:57:31 +0800
huangdengdui <huangdengdui at huawei.com> wrote:
> On 2025/8/7 11:15, Stephen Hemminger wrote:
> > On Thu, 7 Aug 2025 10:49:36 +0800
> > Dengdui Huang <huangdengdui at huawei.com> wrote:
> >
> >> diff --git a/lib/eal/common/eal_common_launch.c b/lib/eal/common/eal_common_launch.c
> >> index a7deac6ecd..be7226e4b6 100644
> >> --- a/lib/eal/common/eal_common_launch.c
> >> +++ b/lib/eal/common/eal_common_launch.c
> >> @@ -36,8 +36,15 @@ RTE_EXPORT_SYMBOL(rte_eal_remote_launch)
> >> int
> >> rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int worker_id)
> >> {
> >> + enum rte_lcore_role_t role;
> >> int rc = -EBUSY;
> >>
> >> + role = lcore_config[worker_id].core_role;
> >> + if (role != ROLE_RTE && role != ROLE_SERVICE) {
> >> + rc = -EINVAL;
> >> + goto finish;
> >> + }
> >
> > worker_id could be any value, if it was out of the range of the array
> > you would end up reading junk.
>
> The lcore should not exceed the RTE_MAX_LCORE range, which should be a common understanding everyone.
> I believe checking it in the code is redundant, updating the documentation be a better solution.
It should be in documentation, but this an exposed API, and all non-datapath API's must
check arguments.
> Moreover, in some interfaces[1], if the lore exceeds the RTE_MAX_LCORE range, it is difficult to determine what value should be returned.
Invalid same as your other checks. or ERANGE?
>
> [1] https://elixir.bootlin.com/dpdk/v25.07/source/lib/eal/include/rte_launch.h#L112
More information about the dev
mailing list