Date: Tue, 7 Feb 2017 14:50:15 +0100 From: Mateusz Guzik <mjguzik@gmail.com> To: Edward Tomasz Napierala <trasz@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm Message-ID: <20170207135014.GC4772@dft-labs.eu> In-Reply-To: <201702062057.v16KvCtI069664@repo.freebsd.org> References: <201702062057.v16KvCtI069664@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 06, 2017 at 08:57:12PM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Mon Feb 6 20:57:12 2017 > New Revision: 313352 > URL: https://svnweb.freebsd.org/changeset/base/313352 > > Log: > Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), kern_vm_munlock(), > kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats > instead of their sys_*() counterparts. > > -sys_mmap(td, uap) > - struct thread *td; > - struct mmap_args *uap; > +sys_mmap(struct thread *td, struct mmap_args *uap) > +{ > + > + return (kern_vm_mmap(td, (vm_offset_t)uap->addr, uap->len, > + uap->prot, uap->flags, uap->fd, uap->pos)); > +} > + > +int > +kern_vm_mmap(struct thread *td, vm_offset_t addr, vm_size_t size, > + vm_prot_t prot, int flags, int fd, off_t pos) > { Can we start dropping the td argument? It always is curthread and almost always has to be anyway as something down below accesses data in a manner only safe for curthread (classic: credential checks). With this example the function takes 7 args. So the commit added an indirection which cannot be tail called on amd64 due to the 7th argument passed through the stack. Removing the td argument deals with the problem. -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170207135014.GC4772>