> Caught by UBSan:
>
> ../lib/hash/rte_thash.c:421:8: runtime error: load of misaligned address
> 0x0001816c2da3 for type 'uint32_t' (aka 'unsigned int'),
> which requires 4 byte alignment
>
> Fixes: 28ebff11c2dc ("hash: add predictable RSS")
> Cc: [email protected]
>
> Signed-off-by: David Marchand <[email protected]>
> ---
> lib/hash/rte_thash.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
> index 6c662bf14f..6d4dbea6d7 100644
> --- a/lib/hash/rte_thash.c
> +++ b/lib/hash/rte_thash.c
> @@ -415,10 +415,10 @@ generate_subkey(struct rte_thash_ctx *ctx, struct
> thash_lfsr *lfsr,
> static inline uint32_t
> get_subvalue(struct rte_thash_ctx *ctx, uint32_t offset)
> {
> - uint32_t *tmp, val;
> + uint32_t tmp, val;
>
> - tmp = (uint32_t *)(&ctx->hash_key[offset >> 3]);
> - val = rte_be_to_cpu_32(*tmp);
> + memcpy(&tmp, &ctx->hash_key[offset >> 3], sizeof(tmp));
> + val = rte_be_to_cpu_32(tmp);
Just wonder do you guys consider it as a real one?
AFAIK, all architectures that we care about do support unaligned load for
32-bit integers.
> val >>= (TOEPLITZ_HASH_LEN - ((offset & (CHAR_BIT - 1)) +
> ctx->reta_sz_log));
>
> --
> 2.49.0
>
- Re: [PATCH v2 04/10] eal: fix plugin dir w... David Marchand
- [PATCH v2 05/10] cmdline: fix port list parsing David Marchand
- Re: [PATCH v2 05/10] cmdline: fix port list pa... Bruce Richardson
- RE: [PATCH v2 05/10] cmdline: fix port list pa... Marat Khalili
- [PATCH v2 06/10] cmdline: fix highest bit port lis... David Marchand
- RE: [PATCH v2 06/10] cmdline: fix highest bit ... Marat Khalili
- [PATCH v2 07/10] tailq: fix cast macro for null po... David Marchand
- RE: [PATCH v2 07/10] tailq: fix cast macro for... Marat Khalili
- [PATCH v2 08/10] hash: fix unaligned access in pre... David Marchand
- Re: [PATCH v2 08/10] hash: fix unaligned acces... Bruce Richardson
- RE: [PATCH v2 08/10] hash: fix unaligned acces... Konstantin Ananyev
- Re: [PATCH v2 08/10] hash: fix unaligned a... David Marchand
- RE: [PATCH v2 08/10] hash: fix unalign... Konstantin Ananyev
- Re: [PATCH v2 08/10] hash: fix un... David Marchand
- RE: [PATCH v2 08/10] hash: fi... Konstantin Ananyev
- Re: [PATCH v2 08/10] hash: fi... David Marchand
- Re: [PATCH v2 08/10] hash: fix unaligned acces... Mattias Rönnblom
- [PATCH v2 09/10] stack: fix unaligned accesses on ... David Marchand
- Re: [PATCH v2 09/10] stack: fix unaligned acce... Bruce Richardson
- [PATCH v2 10/10] build: support Undefined Behavior... David Marchand
- [PATCH v3 00/18] Run with UBSan in GHA David Marchand

