netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init
@ 2015-02-20 20:14 Daniel Borkmann
  2015-02-20 20:16 ` Thomas Graf
  2015-02-20 21:34 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Borkmann @ 2015-02-20 20:14 UTC (permalink / raw)
  To: davem; +Cc: tgraf, netdev, Daniel Borkmann

With object runtime debugging enabled, the rhashtable test suite
will rightfully throw a warning "ODEBUG: object is on stack, but
not annotated" from rhashtable_init().

This is because run_work is (correctly) being initialized via
INIT_WORK(), and not annotated by INIT_WORK_ONSTACK(). Meaning,
rhashtable_init() is okay as is, we just need to move ht e.g.,
into global scope.

It never triggered anything, since test_rhashtable is rather a
controlled environment and effectively runs to completion, so
that stack memory is not vanishing underneath us, we shouldn't
confuse any testers with it though.

Fixes: 7e1e77636e36 ("lib: Resizable, Scalable, Concurrent Hash Table")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 lib/test_rhashtable.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c
index 9c5fcce..58b9953 100644
--- a/lib/test_rhashtable.c
+++ b/lib/test_rhashtable.c
@@ -191,9 +191,10 @@ error:
 	return err;
 }
 
+static struct rhashtable ht;
+
 static int __init test_rht_init(void)
 {
-	struct rhashtable ht;
 	struct rhashtable_params params = {
 		.nelem_hint = TEST_HT_SIZE,
 		.head_offset = offsetof(struct test_obj, node),
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init
  2015-02-20 20:14 [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init Daniel Borkmann
@ 2015-02-20 20:16 ` Thomas Graf
  2015-02-20 21:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Graf @ 2015-02-20 20:16 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev

On 02/20/15 at 09:14pm, Daniel Borkmann wrote:
> With object runtime debugging enabled, the rhashtable test suite
> will rightfully throw a warning "ODEBUG: object is on stack, but
> not annotated" from rhashtable_init().
> 
> This is because run_work is (correctly) being initialized via
> INIT_WORK(), and not annotated by INIT_WORK_ONSTACK(). Meaning,
> rhashtable_init() is okay as is, we just need to move ht e.g.,
> into global scope.
> 
> It never triggered anything, since test_rhashtable is rather a
> controlled environment and effectively runs to completion, so
> that stack memory is not vanishing underneath us, we shouldn't
> confuse any testers with it though.
> 
> Fixes: 7e1e77636e36 ("lib: Resizable, Scalable, Concurrent Hash Table")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Thanks for looking into this.

Acked-by: Thomas Graf <tgraf@suug.ch>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init
  2015-02-20 20:14 [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init Daniel Borkmann
  2015-02-20 20:16 ` Thomas Graf
@ 2015-02-20 21:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-02-20 21:34 UTC (permalink / raw)
  To: daniel; +Cc: tgraf, netdev

From: Daniel Borkmann <daniel@iogearbox.net>
Date: Fri, 20 Feb 2015 21:14:21 +0100

> With object runtime debugging enabled, the rhashtable test suite
> will rightfully throw a warning "ODEBUG: object is on stack, but
> not annotated" from rhashtable_init().
> 
> This is because run_work is (correctly) being initialized via
> INIT_WORK(), and not annotated by INIT_WORK_ONSTACK(). Meaning,
> rhashtable_init() is okay as is, we just need to move ht e.g.,
> into global scope.
> 
> It never triggered anything, since test_rhashtable is rather a
> controlled environment and effectively runs to completion, so
> that stack memory is not vanishing underneath us, we shouldn't
> confuse any testers with it though.
> 
> Fixes: 7e1e77636e36 ("lib: Resizable, Scalable, Concurrent Hash Table")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Applied and queued up for -stable, thanks Daniel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-20 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20 20:14 [PATCH net] rhashtable: don't allocate ht structure on stack in test_rht_init Daniel Borkmann
2015-02-20 20:16 ` Thomas Graf
2015-02-20 21:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).