ila_xlat: add missing hash secret initialization
Subsystems (2)
PATCH 1/1 ila_xlat: add missing hash secret initialization
While discussing the possible merits of clang warning about unused initialized functions, I found one function that was clearly meant to be called but never actually is.
__ila_hash_secret_init() initializes the hash value for the ila locator, apparently this is intended to prevent hash collision attacks, but this ends up being a read-only zero constant since there is no caller. I could find no indication of why it was never called, the earliest patch submission for the module already was like this. If my interpretation is right, we certainly want to backport the patch to stable kernels as well.
I considered adding it to the ila_xlat_init callback, but for best effect the random data is read as late as possible, just before it is first used. The underlying net_get_random_once() is already highly optimized to avoid overhead when called frequently.
--- net/ipv6/ila/ila_xlat.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ila/ila_xlat.c +1 -0
@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) {u32 *v = (u32 *)loc.v32; +__ila_hash_secret_init ();return jhash_2words (v[0 ], v[1 ], hashrnd); }
Signature · 1 line
2.9.0
David Miller
maintainerFrom: Arnd Bergmann <[email protected]>
Date: Thu, 8 Jun 2017 09:54:24 +0200
Quoted 16 lines
While discussing the possible merits of clang warning about unused initialized functions, I found one function that was clearly meant to be called but never actually is.
__ila_hash_secret_init()initializes the hash value for the ila locator, apparently this is intended to prevent hash collision attacks, but this ends up being a read-only zero constant since there is no caller. I could find no indication of why it was never called, the earliest patch submission for the module already was like this. If my interpretation is right, we certainly want to backport the patch to stable kernels as well.I considered adding it to the
ila_xlat_initcallback, but for best effect the random data is read as late as possible, just before it is first used. The underlyingnet_get_random_once()is already highly optimized to avoid overhead when called frequently.
Quoted 4 lines
Fixes 7f00feaf1076 ("ila: Add generic ILA translation facility")Signed-off-by Arnd Bergmann <[email protected]>
Yikes, good catch, applied and queued up for -stable.
Quoted 37 lines · Arnd Bergmann
While discussing the possible merits of clang warning about unused initialized functions, I found one function that was clearly meant to be called but never actually is.
__ila_hash_secret_init()initializes the hash value for the ila locator, apparently this is intended to prevent hash collision attacks, but this ends up being a read-only zero constant since there is no caller. I could find no indication of why it was never called, the earliest patch submission for the module already was like this. If my interpretation is right, we certainly want to backport the patch to stable kernels as well.I considered adding it to the
ila_xlat_initcallback, but for best effect the random data is read as late as possible, just before it is first used. The underlyingnet_get_random_once()is already highly optimized to avoid overhead when called frequently.Fixes 7f00feaf1076 ("ila: Add generic ILA translation facility")Signed-off-by Arnd Bergmann <[email protected]>--- net/ipv6/ila/ila_xlat.c | 1 + 1 file changed, 1 insertion(+)net/ipv6/ila/ila_xlat.c +1
-1@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) {u32 *v = (u32 *)loc.v32; +__ila_hash_secret_init ();return jhash_2words (v[0 ], v[1 ], hashrnd); } --
Quoted 2 lines
2.9.0
Thanks Arnd!