From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752432AbbCZK1k (ORCPT ); Thu, 26 Mar 2015 06:27:40 -0400 Received: from mail.skyhub.de ([78.46.96.112]:51850 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752058AbbCZK1i (ORCPT ); Thu, 26 Mar 2015 06:27:38 -0400 Date: Thu, 26 Mar 2015 11:25:51 +0100 From: Borislav Petkov To: Denys Vlasenko Cc: Ingo Molnar , Linus Torvalds , "H. Peter Anvin" , Denys Vlasenko , Steven Rostedt , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH 3/4] x86/asm/entry/64: use smaller insns Message-ID: <20150326102551.GC27751@pd.tnic> References: <1427303896-24023-1-git-send-email-dvlasenk@redhat.com> <1427303896-24023-3-git-send-email-dvlasenk@redhat.com> <20150326092712.GA27751@pd.tnic> <20150326093732.GC14706@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 26, 2015 at 11:07:42AM +0100, Denys Vlasenko wrote: > In my experiment, GAS uses 10-byte insn only for constants which > won't work with 7-byte encoding; or if I explicitly ask for "movabs": > > _start: .globl _start > mov $0x12345678,%edi # 5 bytes > mov $0x12345678,%rdi # 7 bytes > movq $0x12345678,%rdi # 7 bytes > mov $0x80000000,%rdi # 10 bytes Right, and since they're signed immediates, the AUDIT_ARCH_X86_64 thing is 0xc000003e and does not fit in an s32, thus the 64-bit immediate with bf opcode: mov $0x80000000-1,%rdi mov $0x80000000,%rdi mov $0xc000003e,%rdi mov $0xc000003e,%edi ... 21: 48 c7 c7 ff ff ff 7f mov $0x7fffffff,%rdi 28: 48 bf 00 00 00 80 00 movabs $0x80000000,%rdi 2f: 00 00 00 32: 48 bf 3e 00 00 c0 00 movabs $0xc000003e,%rdi 39: 00 00 00 3c: bf 3e 00 00 c0 mov $0xc000003e,%edi Makes sense to me. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --