From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752620AbdJMWVu (ORCPT ); Fri, 13 Oct 2017 18:21:50 -0400 Received: from mga11.intel.com ([192.55.52.93]:17865 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339AbdJMWVt (ORCPT ); Fri, 13 Oct 2017 18:21:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,371,1503385200"; d="scan'208";a="5894" Subject: Re: [RFC][PATCH] x86, syscalls: use SYSCALL_DEFINE() macros for sys_modify_ldt() To: Andy Lutomirski References: <20171013203929.2260049F@viggo.jf.intel.com> Cc: "linux-kernel@vger.kernel.org" , X86 ML From: Dave Hansen Message-ID: <555fa610-77ab-99d2-70e1-aa2e16bb2c6b@linux.intel.com> Date: Fri, 13 Oct 2017 15:21:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2017 02:03 PM, Andy Lutomirski wrote: >> >> -asmlinkage int sys_modify_ldt(int func, void __user *ptr, >> - unsigned long bytecount) >> +SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr , >> + unsigned long , bytecount) > sys_modify_ldt() returns int, which is wrong, and it's visibly wrong > to 64-bit user code. So I think you need to make sure that the return > value is cast to int in all cases. I'm not quite following. Is there any difference between having something return 'int' and having it return 'long' but only use the lower 32 bits? The caller is surely expecting its result in the lower 32 bits, but this should not change that. Did you just mean that we need to careful to cast the result in sys_modify_ldt() over to an 'int' before returning it?