From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754191AbcGDPOH (ORCPT ); Mon, 4 Jul 2016 11:14:07 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:12305 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbcGDPOE convert rfc822-to-8bit (ORCPT ); Mon, 4 Jul 2016 11:14:04 -0400 X-IronPort-AV: E=Sophos;i="5.26,575,1459814400"; d="scan'208";a="119646071" From: "Tautschnig, Michael" To: Arnd Bergmann , Andi Kleen CC: "x86@kernel.org" , "linux-api@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Thomas Gleixner , "Ingo Molnar" , "H. Peter Anvin" , Jaswinder Singh Subject: Re: [PATCH] Syscall arguments are unsigned long (full registers) Thread-Topic: [PATCH] Syscall arguments are unsigned long (full registers) Thread-Index: AQHR1gBsYP6J2ItZ706QvGoeaX+DHqAIWeCAgAADeoCAAAQCAA== Date: Mon, 4 Jul 2016 15:13:56 +0000 Message-ID: References: <20160704142802.GL25121@tassilo.jf.intel.com> <3421998.D1ABSO4c36@wuerfel> In-Reply-To: <3421998.D1ABSO4c36@wuerfel> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.164.204] Content-Type: text/plain; charset="us-ascii" Content-ID: <709D6ECAE88A2C47BEEF3070C097B7BB@ant.amazon.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 4 Jul 2016, at 16:59, Arnd Bergmann wrote: > > On Monday, July 4, 2016 2:47:10 PM CEST Tautschnig, Michael wrote: >> Thanks a lot for the immediate feedback. >> >>> On 4 Jul 2016, at 16:28, Andi Kleen wrote: >>> >>> On Mon, Jul 04, 2016 at 01:52:58PM +0000, Tautschnig, Michael wrote: >>>> All syscall arguments are passed in as types of the same byte size as >>>> unsigned long (width of full registers). Using a smaller type without a >>>> cast may result in losing bits of information. In all other instances >>>> apart from the ones fixed by the patch the code explicitly introduces >>>> type casts (using, e.g., SYSCALL_DEFINE1). >>>> >>>> While goto-cc reported these problems at build time, it is noteworthy >>>> that the calling conventions specified in the System V AMD64 ABI do >>>> ensure that parameters 1-6 are passed via registers, thus there is no >>>> implied risk of misaligned stack access. >>> >>> Does this actually fix anything? >>> >> >> It will ensure the behaviour on 32 and 64-bit systems is consistent, i.e., >> no truncation occurs. This is to ensure that future uses of these syscalls ^^^ no *hidden* >> do not face surprises. >> [...] > This is the same truncation that we do with SYSCALL_DEFINE2(), > clearing the top 32 bits of the 'code' parameter to ensure that > user space doesn't pass data unexpectedly. > > That change seems reasonable, but why not just use SYSCALL_DEFINE2() > directly for consistency with the other syscalls? > Happy to provide such an updated patch; Andi seemed less confident this should be going ahead? Best, Michael