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
| ||
|
Message-ID: <20151007105934.GB5046@nazgul.tnic> Date: Wed, 7 Oct 2015 12:59:34 +0200 From: Borislav Petkov <bp@...en8.de> To: Andy Lutomirski <luto@...nel.org> Cc: x86@...nel.org, linux-kernel@...r.kernel.org, Brian Gerst <brgerst@...il.com>, Denys Vlasenko <dvlasenk@...hat.com>, Linus Torvalds <torvalds@...ux-foundation.org> Subject: Re: [PATCH v2 02/36] x86/uaccess: __chk_range_not_ok is unlikely to return true On Mon, Oct 05, 2015 at 05:47:50PM -0700, Andy Lutomirski wrote: > This should improve code quality a bit. It also shrinks the kernel > text. > > Before: > text data bss dec hex filename > 21828379 5194760 1277952 28301091 1afd723 vmlinux > text data bss dec hex filename > 21827997 5194760 1277952 28300709 1afd5a5 vmlinux > > Signed-off-by: Andy Lutomirski <luto@...nel.org> > --- > arch/x86/include/asm/uaccess.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h > index 3e911c68876e..09b1b0ab94b7 100644 > --- a/arch/x86/include/asm/uaccess.h > +++ b/arch/x86/include/asm/uaccess.h > @@ -51,13 +51,13 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un > * limit, not add it to the address). > */ > if (__builtin_constant_p(size)) > - return addr > limit - size; > + return unlikely(addr > limit - size); > > /* Arbitrary sizes? Be careful about overflow */ > addr += size; > - if (addr < size) > + if (unlikely(addr < size)) > return true; > - return addr > limit; > + return unlikely(addr > limit); It certainly uglifies it though. Are the wins worth the (un-)readability hit? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists