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
| ||
|
Date: Tue, 27 Sep 2016 11:58:31 +0200 From: Hannes Frederic Sowa <hannes@...essinduktion.org> To: Maciej Żenczykowski <maze@...gle.com> Cc: "David S . Miller" <davem@...emloft.net>, Linux NetDev <netdev@...r.kernel.org>, Erik Kline <ek@...gle.com>, Lorenzo Colitti <lorenzo@...gle.com> Subject: Re: [PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router solicitation backoff On 27.09.2016 11:42, Maciej Żenczykowski wrote: >> Please just use do_div here and go back to the first version of the >> patch. Variable names could be more aligned with the RFC maybe? > > So I tried: > > static inline s32 rfc3315_s14_backoff_init(s32 irt) > { > /* multiply 'initial retransmission time' by 0.9 .. 1.1 */ > u64 tmp = (900000 + prandom_u32() % 200001) * (u64)irt; > do_div(tmp, 1000000); > return (s32)tmp; > } > > static inline s32 rfc3315_s14_backoff_update(s32 rt, s32 mrt) > { > /* multiply 'retransmission timeout' by 1.9 .. 2.1 */ > u64 tmp = (1900000 + prandom_u32() % 200001) * (u64)rt; > do_div(tmp, 1000000); > if ((s32)tmp > mrt) { > /* multiply 'maximum retransmission time' by 0.9 .. 1.1 */ > tmp = (900000 + prandom_u32() % 200001) * (u64)mrt; > do_div(tmp, 1000000); > } > return (s32)tmp; > } > > but then building for i386 I get: > > ERROR: "__udivdi3" [net/netfilter/xt_hashlimit.ko] undefined! > > which happens even at net-next/master itself. > > Anyway, I'll resubmit assuming the above is what you're looking for... I think the __udivdi3 comes from the fact you are doing the modulo operation and the reciprocal divide optimization doesn't work in this case thus you end up with the call to libgcc. Can you use the remainder from the do_div operation also? u32 r = prandom_u32(); u64 tmp = (900000 + do_div(r,200001)) * (u64)irt; Depending on if you keep the values in ms or jiffies, maybe it would make sense to simply use msecs_to_jiffies and vice versa? Thanks, Hannes
Powered by blists - more mailing lists