[dpdk-stable] [PATCH v3] test/hash: fix buffer overflow
    Medvedkin, Vladimir 
    vladimir.medvedkin at intel.com
       
    Tue Oct 19 17:57:47 CEST 2021
    
    
  
Hi David,
On 19/10/2021 09:02, David Marchand wrote:
> On Fri, Oct 15, 2021 at 3:02 PM Medvedkin, Vladimir
> <vladimir.medvedkin at intel.com> wrote:
>>> I am confused.
>>> Does it mean that rte_jhash_32b is not compliant with rte_hash_create API?
>>>
>>
>> I think so too, because despite the fact that the ABI is the same, the
>> API remains different with respect to the length argument.
> 
> Sorry I don't follow you with "ABI is the same".
> Can you explain please?
> 
I meant that rte_hash accepts:
/** Type of function that can be used for calculating the hash value. */
typedef uint32_t (*rte_hash_function)(const void *key, uint32_t key_len, 
  uint32_t init_val);
as a hash function. And signatures of rte_jhash() and rte_jhash_32b() 
are the same, but differ in the semantics of the "key_len" argument. 
Internally rte_hash passes a length of the key counted in bytes to this 
functions, so problems appears if configured hash function considers the 
key_len as something else than the size in bytes.
> 
> I am not against the fix, but it seems to test something different
> than what an application using the hash library would do.
> Or if an application directly calls this hash function, maybe the unit
> test should not test it via rte_hash_create (which seems to defeat the
> abstraction).
> 
I'd say that user should not use this hash function with rte_hash.
Yipeng, Sameh, Bruce,
what do you think?
> 
-- 
Regards,
Vladimir
    
    
More information about the stable
mailing list