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


Groups > linux.kernel > #1728353

xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the restore_c_regs_and_iret label)

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the restore_c_regs_and_iret label)
Date 2017-09-07 20:00 +0200
Message-ID <un9fT-3ll-73@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Sep 7, 2017 at 3:29 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> not the best of kernels, 32-bit allyesconfig doesn't even appear to build:
>
>   net/netfilter/xt_hashlimit.o: In function `hashlimit_mt_common.isra.6':
>   xt_hashlimit.c:(.text+0x1146): undefined reference to `__udivdi3'

I think this is due to commit bea74641e378 ("netfilter: xt_hashlimit:
add rate match mode").

It adds a 64-bit divide in user2rate_bytes() afaik, and to make things
worse it seems to be a really stupid one too.

Although I guess "worse" is not bad when the stupidity of it should
mean that it's easy to avoid the 64-bit issue.

Oddly, user2rate() that actually *does* need a 64-bit divide, seems to
do it right and use "div64_u64()" to do so.

But user2rate_bytes() could easily avoid any 64-bit issues, since it
divides the max 32-bit (unsigned) number with a 64-bit unsigned
number.

It would be easy to just say

 - "if high 32 bits are set, result is 0"

 - else do a 32-bit divide

or just use "div64_u64()" in that code too.

But honestly, that math is odd in other ways too (is that "r-1"
_supposed_ to underflow to -1 for large 'user' counts?), so somebody
needs to look at that logic.

And there might be some other 64-bit divide I missed, so please,
netfilter people, check the 32-bit build.

                  Linus

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


Thread

xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the  restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 20:00 +0200
  Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 20:30 +0200
    Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 20:50 +0200
      Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 22:20 +0200
        Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 22:50 +0200
          Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 23:30 +0200
        RE: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) "Lubashev, Igor" <ilubashe@akamai.com> - 2017-09-07 22:50 +0200

csiph-web