lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 27 Sep 2016 12:15:54 +0800
From:   Liping Zhang <zlpnobody@...il.com>
To:     Vishwanath Pai <vpai@...mai.com>
Cc:     Pablo Neira Ayuso <pablo@...filter.org>,
        Patrick McHardy <kaber@...sh.net>,
        Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>, johunt@...mai.com,
        netfilter-devel@...r.kernel.org, coreteam@...filter.org,
        netdev@...r.kernel.org, pai.vishwain@...il.com
Subject: Re: [PATCH v3 2/2] netfilter: Create revision 2 of xt_hashlimit to
 support higher pps rates

Hi Vishwanath,

2016-09-23 0:43 GMT+08:00 Vishwanath Pai <vpai@...mai.com>:
>
>  /* Precision saver. */
> -static u32 user2credits(u32 user)
> +static u64 user2credits(u64 user, int revision)
>  {
> -       /* If multiplying would overflow... */
> -       if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY_v1))
> -               /* Divide first. */
> -               return (user / XT_HASHLIMIT_SCALE_v1) *\
> -                                       HZ * CREDITS_PER_JIFFY_v1;
> +       if (revision == 1) {
> +               /* If multiplying would overflow... */
> +               if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY_v1))
> +                       /* Divide first. */
> +                       return (user / XT_HASHLIMIT_SCALE_v1) *\
> +                                               HZ * CREDITS_PER_JIFFY_v1;
> +
> +               return (user * HZ * CREDITS_PER_JIFFY_v1) \
> +                                               / XT_HASHLIMIT_SCALE_v1;
> +       } else {
> +               if (user > 0xFFFFFFFFFFFFFFFF / (HZ*CREDITS_PER_JIFFY))
> +                       return (user / XT_HASHLIMIT_SCALE) *\
> +                                               HZ * CREDITS_PER_JIFFY;
>
> -       return (user * HZ * CREDITS_PER_JIFFY_v1) / XT_HASHLIMIT_SCALE_v1;
> +               return (user * HZ * CREDITS_PER_JIFFY) / XT_HASHLIMIT_SCALE;
> +       }
>  }
>

In my memory, 64-bit division operation should be replaced by
div_u64 or div64_u64, otherwise on some 32-bit architecture
systems, link error will happen. Something like this:
... undefined reference to `__udivdi3'.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ