Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109744853
D2335.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D2335.diff
View Options
Index: head/sys/compat/linux/linux_getcwd.c
===================================================================
--- head/sys/compat/linux/linux_getcwd.c
+++ head/sys/compat/linux/linux_getcwd.c
@@ -57,6 +57,7 @@
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
#endif
+#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_util.h>
#include <security/mac/mac_framework.h>
@@ -423,14 +424,14 @@
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) {
Index: head/sys/compat/linux/linux_misc.h
===================================================================
--- head/sys/compat/linux/linux_misc.h
+++ head/sys/compat/linux/linux_misc.h
@@ -55,6 +55,8 @@
#define LINUX_MREMAP_MAYMOVE 1
#define LINUX_MREMAP_FIXED 2
+#define LINUX_PATH_MAX 4096
+
extern const char *linux_platform;
/*
Index: head/sys/kern/vfs_cache.c
===================================================================
--- head/sys/kern/vfs_cache.c
+++ head/sys/kern/vfs_cache.c
@@ -1053,11 +1053,13 @@
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 @@
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;
Index: head/sys/sys/syscallsubr.h
===================================================================
--- head/sys/sys/syscallsubr.h
+++ head/sys/sys/syscallsubr.h
@@ -58,7 +58,7 @@
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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 10, 12:17 AM (37 m, 52 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16549469
Default Alt Text
D2335.diff (2 KB)
Attached To
Mode
D2335: 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.
Attached
Detach File
Event Timeline
Log In to Comment