Merge branch 'fix-truncation-bug-in-coerce_reg_to_size_sx-and-extend-selftests'
authorAlexei Starovoitov <ast@kernel.org>
Tue, 15 Oct 2024 18:16:25 +0000 (11:16 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 15 Oct 2024 18:16:25 +0000 (11:16 -0700)
commitee230090f62fbb1c63c7f305d57289ab753221ef
treee182ec5e34751574f8d6d7a69ddb8f77a40bc0c4
parentb836cbdf3b81a4a22b3452186efa2e5105a77e10
parent35ccd576a23ce495b4064f4a3445626de790cd23
Merge branch 'fix-truncation-bug-in-coerce_reg_to_size_sx-and-extend-selftests'

Dimitar Kanaliev says:

====================
Fix truncation bug in coerce_reg_to_size_sx and extend selftests.

This patch series addresses a truncation bug in the eBPF verifier function
coerce_reg_to_size_sx(). The issue was caused by the incorrect ordering
of assignments between 32-bit and 64-bit min/max values, leading to
improper truncation when updating the register state. This issue has been
reported previously by Zac Ecob[1] , but was not followed up on.

The first patch fixes the assignment order in coerce_reg_to_size_sx()
to ensure correct truncation. The subsequent patches add selftests for
coerce_{reg,subreg}_to_size_sx.

Changelog:
v1 -> v2:
 - Moved selftests inside the conditional check for cpuv4

[1] (https://lore.kernel.org/bpf/h3qKLDEO6m9nhif0eAQX4fVrqdO0D_OPb0y5HfMK9jBePEKK33wQ3K-bqSVnr0hiZdFZtSJOsbNkcEQGpv_yJk61PAAiO8fUkgMRSO-lB50=@protonmail.com/)
====================

Link: https://lore.kernel.org/r/20241014121155.92887-1-dimitar.kanaliev@siteground.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>