Re: [PATCH 10/13] util: hash: Reimplement virHashTable using GHashTable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 26, 2020 at 04:45:50PM +0100, Peter Krempa wrote:
> Glib's hash table provides basically the same functionality as our hash
> table.
> 
> In most cases the only thing that remains in the virHash* wrappers is
> NULL-checks of '@table' argument as glib's hash functions don't tolerate
> NULL.
> 
> In case of iterators, we adapt the existing API of iterators to glibs to
> prevent having rewrite all callers at this point.
> 
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms |   4 -
>  src/util/meson.build     |   1 -
>  src/util/virhash.c       | 416 ++++++++++-----------------------------
>  src/util/virhash.h       |   4 +-
>  src/util/virhashcode.c   | 125 ------------
>  src/util/virhashcode.h   |  33 ----

Our hash code impl uses Murmurhash which makes some efforts to be
robust against malicious inputs triggering collisons, notably using
a random seed.

The new code uses  g_str_hash which is much weaker, and the API
docs explicitly recommend against using it if the input can be from
an untrusted user.

IOW, I don't think we should be removing our virhashcode impl. If
anything we should upgrade our hash code impl to use SipHash which
is used by perl, python, ruby, rust and more.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux