Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500522

Re: slab corruption with current -git

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: slab corruption with current -git
Date 2016-10-13 22:00 +0200
Message-ID <srUkx-7Wj-1@gated-at.bofh.it> (permalink)
References (3 earlier) <sr14K-4tt-13@gated-at.bofh.it> <srHnj-87T-3@gated-at.bofh.it> <srHnj-87T-1@gated-at.bofh.it> <srHGF-8ks-13@gated-at.bofh.it> <srHGF-8ks-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 12, 2016 at 11:27 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
>
> Yeah.
>
> 105         entry->orig_ops = reg;
> 106         entry->ops      = *reg;
> 107         entry->next     = NULL;

So ipt_register_table() does:

        ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));

and then nf_register_net_hooks() just does

        for (i = 0; i < n; i++) {
                err = nf_register_net_hook(net, &reg[i]);

so if the *reg is uninitialized, it means that it's the 'ops[]' array
that isn't actually really valid in "valid_hooks". Odd. They should
all be initialized by xt_hook_ops_alloc(), no?

That said, xt_hook_ops_alloc() itself is odd. Lookie here, this is the
loop that initializes things:

        for (i = 0, hooknum = 0; i < num_hooks && hook_mask != 0;
             hook_mask >>= 1, ++hooknum) {

and it makes no sense to me how that tests *both* "i < num_hools" and
"hook_mask != 0".

Why? Because

    num_hooks = hweight32(hook_mask);

so it's entirely redundant. num_hooks is already how many bits are on
in hook_mask, so that test is just duplicating the same thing twice
("have we done less than that number of bits" and "do we have any bits
less").

I don't know. There's something odd going on. Regardless, thsi is a
different problem from the nf_register_net_hook() list handling, so
I'll leave it to the networking people. David?

               Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: slab corruption with current -git Markus Trippelsdorf <markus@trippelsdorf.de> - 2016-10-13 08:10 +0200
  Re: slab corruption with current -git Markus Trippelsdorf <markus@trippelsdorf.de> - 2016-10-13 08:30 +0200
    Re: slab corruption with current -git Linus Torvalds <torvalds@linux-foundation.org> - 2016-10-13 22:00 +0200
      Re: slab corruption with current -git Florian Westphal <fw@strlen.de> - 2016-10-13 22:50 +0200
      Re: slab corruption with current -git Al Viro <viro@ZenIV.linux.org.uk> - 2016-10-13 23:40 +0200

csiph-web