On 5/3/24 13:44, Simon Horman wrote:
> On Fri, May 03, 2024 at 07:44:13AM +0200, Ales Musil wrote:
>> Partially revert db5a101931c5, this was to avoid warning, however we
>> shouldn't use pointer to "uint32_t" when the data are potentially
>> unaligned [0]. Use pointer to "uint8_t" right from the start, this
>> requires us to use ALIGNED_CAST for the get_unaligned_u32, which is
>> fine in that case, because the function uses
>> " __attribute__((__packed__))" struct to access the underlying "uint32_t".
>>
>> lib/hash.c:46:22: runtime error: load of misaligned address
>> 0x507000000065 for type 'const uint32_t *' (aka 'const unsigned int *'),
>> which requires 4 byte alignment
>> 0x507000000065: note: pointer points here
>>  73 62 2e 73 6f 63 6b  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>>              ^
>>   00 00 00 00 00 00 00 00  00
>>     0 0x6191cb in hash_bytes ovs/lib/hash.c:46:9
>>     1 0x69d064 in hash_string ovs/lib/hash.h:404:12
>>     2 0x69d064 in hash_name ovs/lib/shash.c:29:12
>>     3 0x69d064 in shash_find ovs/lib/shash.c:237:49
>>     4 0x69dada in shash_find_data ovs/lib/shash.c:251:31
>>     5 0x507987 in add_remote ovs/ovsdb/ovsdb-server.c:1382:15
>>     6 0x507987 in parse_options ovs/ovsdb/ovsdb-server.c:2659:13
>>     7 0x507987 in main ovs/ovsdb/ovsdb-server.c:751:5
>>
>> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib/hash.c:46:22
>>
>> [0] https://github.com/llvm/llvm-project/issues/90848
>> Fixes: db5a101931c5 ("clang: Fix the alignment warning.")
>> Signed-off-by: Ales Musil <amu...@redhat.com>
>> ---
>> v3: Do partial revert of db5a101931c5 instead of simple cast.
> 
> Acked-by: Simon Horman <ho...@ovn.org>
> 

Thanks, Ales, Eelco and Simon!

Applied and backported down to 2.17.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to