Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750999AbcCHSaX (ORCPT ); Tue, 8 Mar 2016 13:30:23 -0500 Received: from mail-ob0-f177.google.com ([209.85.214.177]:33959 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbcCHSaV (ORCPT ); Tue, 8 Mar 2016 13:30:21 -0500 MIME-Version: 1.0 In-Reply-To: <20160308102755.GA5407@gmail.com> References: <3cc149b4ce9a108a092d816c5158808c62c557f0.1457285880.git.luto@kernel.org> <20160307082228.GA11026@gmail.com> <20160308102755.GA5407@gmail.com> From: Andy Lutomirski Date: Tue, 8 Mar 2016 10:29:56 -0800 Message-ID: Subject: Re: [PATCH] x86/entry: Improve system call entry comments To: Ingo Molnar Cc: Thomas Gleixner , Borislav Petkov , X86 ML , Andrew Morton , Oleg Nesterov , Andrew Cooper , Peter Zijlstra , Brian Gerst , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , Linus Torvalds Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2402 Lines: 69 On Mar 8, 2016 2:27 AM, "Ingo Molnar" wrote: > > > * Andy Lutomirski wrote: > > > > > ENTRY(entry_INT80_32) > > > > > > entry_INT80_32() is only used on pure 32-bit kernels, 64-bit kernels use > > > entry_INT80_compat(). So the above text should not talk about 64-bit programs, as > > > they can never trigger this specific entry point, right? > > > > > > > 64-bit programs can and sometimes do trigger this entry point. [...] > > How can 64-bit programs trigger entry_INT80_32? It's only ever set on 32-bit > kernels: > > #ifdef CONFIG_X86_32 > set_system_trap_gate(IA32_SYSCALL_VECTOR, entry_INT80_32); > set_bit(IA32_SYSCALL_VECTOR, used_vectors); > #endif > > > [...] It does a 32-bit syscall regardless of the caller's bitness, but it > > returns back to the caller's original context, whatever it was. > > That's true of INT $0x80, but I'm talking about the entry point: AFAICS > entry_INT80_32 can only ever execute on 32-bit kernels. Oh, duh. > > We don't even build the entry_32.S::entry_INT80_32 entry point on 64-bit kernels: > > obj-y := entry_$(BITS).o [...] > > > > > > So I'd change the explanation to something like: > > > > > > > + * This entry point is active on 32-bit kernels and can thus be used by 32-bit > > > > + * programs to perform 32-bit system calls. (Programs running on 64-bit > > > > + * kernels executing INT $0x80 will land on another entry point: > > > > + * entry_INT80_compat. The ABI is identical.) > > > > I like the part in parentheses. > > So the part in parentheses conflict with your above statement :) > > What I wanted to say with this: > > > > > + * This entry point is active on 32-bit kernels and can thus be used by 32-bit > > > > + * programs to perform 32-bit system calls. (Programs running on 64-bit > > > > + * kernels executing INT $0x80 will land on another entry point: > > > > + * entry_INT80_compat. The ABI is identical.) > > ... is what it says: that entry_INT80_32 is only active on 32-bit kernels, running > 32-bit programs, performing 32-bit system calls. > > Programs running on 64-bit kernels can use INT $0x80 as well, but will land on > another, different, 64-bit kernel specific entry point. > > What am I missing? > Nothing. I mis-read your earlier email. Want to fix and apply it, or should I send a new version? > Thanks, > > Ingo