From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com MIME-Version: 1.0 Sender: keescook@google.com In-Reply-To: <20161110204046.GW3117@twins.programming.kicks-ass.net> References: <1478809488-18303-1-git-send-email-elena.reshetova@intel.com> <1478809488-18303-13-git-send-email-elena.reshetova@intel.com> <20161110204046.GW3117@twins.programming.kicks-ass.net> From: Kees Cook Date: Thu, 10 Nov 2016 13:04:20 -0800 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [kernel-hardening] Re: [RFC v4 PATCH 12/13] x86: implementation for HARDENED_ATOMIC To: Peter Zijlstra Cc: Elena Reshetova , "kernel-hardening@lists.openwall.com" , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Will Deacon , Hans Liljestrand , David Windsor List-ID: On Thu, Nov 10, 2016 at 12:40 PM, Peter Zijlstra wrote: > On Thu, Nov 10, 2016 at 10:24:47PM +0200, Elena Reshetova wrote: >> static __always_inline void atomic_add(int i, atomic_t *v) >> { >> + asm volatile(LOCK_PREFIX "addl %1,%0\n" >> + >> +#ifdef CONFIG_HARDENED_ATOMIC >> + "jno 0f\n" >> + LOCK_PREFIX "subl %1,%0\n" >> + "int $4\n0:\n" >> + _ASM_EXTABLE(0b, 0b) > > > This is unreadable gunk. > >> +#endif >> + >> : "+m" (v->counter) >> : "ir" (i)); >> } How would you suggest it be made readable? Or rather, what don't you like about it? -Kees -- Kees Cook Nexus Security