Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164509035
D58506.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58506.diff
View Options
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -32,12 +32,12 @@
#include "opt_ktrace.h"
#include "opt_vm.h"
-#include <sys/param.h>
#include <sys/systm.h>
#include <sys/acct.h>
#include <sys/asan.h>
#include <sys/capsicum.h>
#include <sys/compressor.h>
+#include <sys/dirent.h>
#include <sys/eventhandler.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
@@ -568,12 +568,46 @@
newbinname[nd.ni_cnd.cn_namelen] = '\0';
imgp->vp = newtextvp;
+ if (atomic_load_8(&newtextdvp->v_type) != VDIR) {
+ struct vnode *dvp1;
+ char *buf1;
+ size_t buf1len;
+
+ /*
+ * The newtextdvp vnode might be not a
+ * directory when reclaimed or when the image
+ * is mounted over a regular file. In the
+ * latter case, try to resolve the containing
+ * directory.
+ *
+ * In any case, p_textdvp must be either a
+ * directory or reclaimed.
+ */
+ VOP_UNLOCK(imgp->vp);
+ dvp1 = newtextdvp;
+ buf1len = MAXNAMLEN + 1;
+ buf1 = malloc(buf1len, M_TEMP, M_WAITOK);
+ error = vn_vptocnp(&dvp1, buf1, &buf1len);
+ if (error == 0) {
+ if (atomic_load_8(&dvp1->v_type) == VDIR) {
+ newtextdvp = dvp1;
+ } else {
+ vrele(dvp1);
+ newtextdvp = NULL;
+ }
+ } else {
+ newtextdvp = NULL;
+ }
+ free(buf1, M_TEMP);
+ vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
+ }
+
/*
* Do the best to calculate the full path to the image file.
*/
if (args->fname[0] == '/') {
imgp->execpath = args->fname;
- } else {
+ } else if (newtextdvp != NULL) {
VOP_UNLOCK(imgp->vp);
freepath_size = MAXPATHLEN;
if (vn_fullpath_hardlink(newtextvp, newtextdvp,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 2, 2:00 PM (17 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35717144
Default Alt Text
D58506.diff (1 KB)
Attached To
Mode
D58506: kern_execve(): avoid storing non-VDIR into p_textdvp
Attached
Detach File
Event Timeline
Log In to Comment