From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guo Ren Subject: Re: [PATCH V3 05/26] csky: System Call Date: Fri, 7 Sep 2018 09:47:57 +0800 Message-ID: <20180907014757.GB8288@guoren-Inspiron-7460> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Arnd Bergmann Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, Thomas Petazzoni , wbx@uclibc-ng.org, Greentime Hu List-Id: linux-arch.vger.kernel.org On Thu, Sep 06, 2018 at 04:10:49PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > +SYSCALL_DEFINE6(mmap2, > > + unsigned long, addr, > > + unsigned long, len, > > + unsigned long, prot, > > + unsigned long, flags, > > + unsigned long, fd, > > + off_t, offset) > > +{ > > + if (unlikely(offset & (~PAGE_MASK >> 12))) > > + return -EINVAL; > > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > > + offset >> (PAGE_SHIFT - 12)); > > +} > > Please call ksys_mmap_pgoff() instead of sys_mmap_pgoff() here. Ok. > The prototype in include/asm-generic/syscalls.h uses 'unsigned long' > for the last argument as well, not off_t. Ok, unsigned long for last argument. > > +struct mmap_arg_struct { > > + unsigned long addr; > > + unsigned long len; > > + unsigned long prot; > > + unsigned long flags; > > + unsigned long fd; > > + unsigned long offset; > > +}; > > + > > +SYSCALL_DEFINE1(mmap, > > + struct mmap_arg_struct *, arg) > > Something is still wrong here, there should be no way to > call sys_mmap(), since it's not in the syscall table. You are right, remove it. > > + return sys_fadvise64_64(fd, offset, len, advice); > > +} > > And call ksys_fadvise64_64() here. Ok. Guo Ren From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:39875 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbeIGG1r (ORCPT ); Fri, 7 Sep 2018 02:27:47 -0400 Date: Fri, 7 Sep 2018 09:47:57 +0800 From: Guo Ren Subject: Re: [PATCH V3 05/26] csky: System Call Message-ID: <20180907014757.GB8288@guoren-Inspiron-7460> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Arnd Bergmann Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, Thomas Petazzoni , wbx@uclibc-ng.org, Greentime Hu Message-ID: <20180907014757.RYBScGhyn4KTscHB5C2JS7_g9F7S46PpUC5aUjgpUpQ@z> On Thu, Sep 06, 2018 at 04:10:49PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > +SYSCALL_DEFINE6(mmap2, > > + unsigned long, addr, > > + unsigned long, len, > > + unsigned long, prot, > > + unsigned long, flags, > > + unsigned long, fd, > > + off_t, offset) > > +{ > > + if (unlikely(offset & (~PAGE_MASK >> 12))) > > + return -EINVAL; > > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > > + offset >> (PAGE_SHIFT - 12)); > > +} > > Please call ksys_mmap_pgoff() instead of sys_mmap_pgoff() here. Ok. > The prototype in include/asm-generic/syscalls.h uses 'unsigned long' > for the last argument as well, not off_t. Ok, unsigned long for last argument. > > +struct mmap_arg_struct { > > + unsigned long addr; > > + unsigned long len; > > + unsigned long prot; > > + unsigned long flags; > > + unsigned long fd; > > + unsigned long offset; > > +}; > > + > > +SYSCALL_DEFINE1(mmap, > > + struct mmap_arg_struct *, arg) > > Something is still wrong here, there should be no way to > call sys_mmap(), since it's not in the syscall table. You are right, remove it. > > + return sys_fadvise64_64(fd, offset, len, advice); > > +} > > And call ksys_fadvise64_64() here. Ok. Guo Ren