From owner-svn-src-head@freebsd.org Thu Jan 7 09:31:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D6E1A65EA4; Thu, 7 Jan 2016 09:31:03 +0000 (UTC) (envelope-from dchagin@chd.heemeyer.club) Received: from heemeyer.club (heemeyer.club [108.61.204.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "heemeyer.club", Issuer "heemeyer.club" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BDAF11A7; Thu, 7 Jan 2016 09:31:02 +0000 (UTC) (envelope-from dchagin@chd.heemeyer.club) Received: from chd.heemeyer.club ([78.107.232.239]) by heemeyer.club (8.15.2/8.15.1) with ESMTPS id u079Uwf8021635 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Jan 2016 09:31:00 GMT (envelope-from dchagin@chd.heemeyer.club) X-Authentication-Warning: heemeyer.club: Host [78.107.232.239] claimed to be chd.heemeyer.club Received: from chd.heemeyer.club (localhost [127.0.0.1]) by chd.heemeyer.club (8.15.2/8.15.1) with ESMTPS id u079Uwrf045664 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 Jan 2016 12:30:58 +0300 (MSK) (envelope-from dchagin@chd.heemeyer.club) Received: (from dchagin@localhost) by chd.heemeyer.club (8.15.2/8.15.1/Submit) id u079Uvfa045658; Thu, 7 Jan 2016 12:30:57 +0300 (MSK) (envelope-from dchagin) Date: Thu, 7 Jan 2016 12:30:57 +0300 From: Chagin Dmitry To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r281829 - in head/sys: compat/linux kern sys Message-ID: <20160107093057.GA40473@chd.heemeyer.club> References: <201504211355.t3LDtOen059543@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201504211355.t3LDtOen059543@svn.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 09:31:03 -0000 On Tue, Apr 21, 2015 at 01:55:24PM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Tue Apr 21 13:55:24 2015 > New Revision: 281829 > URL: https://svnweb.freebsd.org/changeset/base/281829 > > Log: > Modify kern___getcwd() to take max pathlen limit as an additional > argument. This will be used for the Linux emulation layer - for Linux, > PATH_MAX is 4096 and not 1024. > > Differential Revision: https://reviews.freebsd.org/D2335 > Reviewed by: kib@ > MFC after: 1 month > Sponsored by: The FreeBSD Foundation hi, do you plan to merge it some time? > > Modified: > head/sys/compat/linux/linux_getcwd.c > head/sys/compat/linux/linux_misc.h > head/sys/kern/vfs_cache.c > head/sys/sys/syscallsubr.h > > Modified: head/sys/compat/linux/linux_getcwd.c > ============================================================================== > --- head/sys/compat/linux/linux_getcwd.c Tue Apr 21 11:50:31 2015 (r281828) > +++ head/sys/compat/linux/linux_getcwd.c Tue Apr 21 13:55:24 2015 (r281829) > @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #endif > +#include > #include > > #include > @@ -423,14 +424,14 @@ linux_getcwd(struct thread *td, struct l > > len = args->bufsize; > > - if (len > MAXPATHLEN*4) > - len = MAXPATHLEN*4; > + if (len > LINUX_PATH_MAX) > + len = LINUX_PATH_MAX; > else if (len < 2) > return ERANGE; > > path = malloc(len, M_TEMP, M_WAITOK); > > - error = kern___getcwd(td, path, UIO_SYSSPACE, len); > + error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX); > if (!error) { > lenused = strlen(path) + 1; > if (lenused <= args->bufsize) { > > Modified: head/sys/compat/linux/linux_misc.h > ============================================================================== > --- head/sys/compat/linux/linux_misc.h Tue Apr 21 11:50:31 2015 (r281828) > +++ head/sys/compat/linux/linux_misc.h Tue Apr 21 13:55:24 2015 (r281829) > @@ -55,6 +55,8 @@ > #define LINUX_MREMAP_MAYMOVE 1 > #define LINUX_MREMAP_FIXED 2 > > +#define LINUX_PATH_MAX 4096 > + > extern const char *linux_platform; > > /* > > Modified: head/sys/kern/vfs_cache.c > ============================================================================== > --- head/sys/kern/vfs_cache.c Tue Apr 21 11:50:31 2015 (r281828) > +++ head/sys/kern/vfs_cache.c Tue Apr 21 13:55:24 2015 (r281829) > @@ -1053,11 +1053,13 @@ sys___getcwd(td, uap) > struct __getcwd_args *uap; > { > > - return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen)); > + return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen, > + MAXPATHLEN)); > } > > int > -kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) > +kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen, > + u_int path_max) > { > char *bp, *tmpbuf; > struct filedesc *fdp; > @@ -1068,8 +1070,8 @@ kern___getcwd(struct thread *td, char *b > return (ENODEV); > if (buflen < 2) > return (EINVAL); > - if (buflen > MAXPATHLEN) > - buflen = MAXPATHLEN; > + if (buflen > path_max) > + buflen = path_max; > > tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); > fdp = td->td_proc->p_fd; > > Modified: head/sys/sys/syscallsubr.h > ============================================================================== > --- head/sys/sys/syscallsubr.h Tue Apr 21 11:50:31 2015 (r281828) > +++ head/sys/sys/syscallsubr.h Tue Apr 21 13:55:24 2015 (r281829) > @@ -58,7 +58,7 @@ struct thr_param; > struct __wrusage; > > int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, > - u_int buflen); > + u_int buflen, u_int path_max); > int kern_accept(struct thread *td, int s, struct sockaddr **name, > socklen_t *namelen, struct file **fp); > int kern_accept4(struct thread *td, int s, struct sockaddr **name, -- Have fun! chd