Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422810AbcDNRtE (ORCPT ); Thu, 14 Apr 2016 13:49:04 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:36275 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422739AbcDNRs7 (ORCPT ); Thu, 14 Apr 2016 13:48:59 -0400 MIME-Version: 1.0 In-Reply-To: <1460654550.4560.9.camel@decadent.org.uk> References: <1460654550.4560.9.camel@decadent.org.uk> From: Andy Lutomirski Date: Thu, 14 Apr 2016 10:48:31 -0700 Message-ID: Subject: Re: System call number masking To: Ben Hutchings Cc: Andy Lutomirski , X86 ML , LKML 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: 1281 Lines: 30 On Thu, Apr 14, 2016 at 10:22 AM, Ben Hutchings wrote: > I'm updating my x32-as-boot-time-option patch for 4.6, and I noticed a > subtle change in system call number masking on x86_64 as a result of > moving the slow path into C. > > Previously we would mask out the upper 32 bits before doing anything > with the system call number, both on the slow and fast paths, if and > only if x32 was enabled. I always thought that the old behavior was nonsensical. The behavior should be the same regardless of config options. > > Now we always mask out the upper 32 bits on the slow path, so it's not > quite consistent with the fast path if x32 is disabled. A system call > that would be rejected by the fast path can succeed on the slow path. > I don't know whether this causes any problems, but it seems > undesirable. > > But it's also undesirable that the behaviour of system call numbers not > assigned to x32 also varies depending on whether x32 is enabled. > Should we always mask out the upper 32 bits on the fast path? > I think we should. Alternatively, the ja 1f that takes us back out if the syscall nr is invalid could be changed to jump to the slow path, thus avoiding an instruction in the fast path and keeping the code a bit cleaner. --Andy