Skip to content

Commit

Permalink
emulators/virtualbox-ose-additions-legacy: Import improvements from n…
Browse files Browse the repository at this point in the history
…on legacy port

Import changes from commit 1b23945 to legacy port:

In the virtualbox virtual filesystem code we ship as a patch some
code in an else block is commented out. This produces a code path
in which a pointer variable is dereferenced in an unassigned state,
causing random crashes.

Lacking a better fix, give a default value of NULL to the pointer,
which at least avoids the random pointer dereference issue.

PR:		255386

Alsso import fix for building on recent head from cec55f41e10f13:

Fix build after head commit b4a58fbf640409a1 (vfs: remove cn_thread)

MFH:            2021Q4
  • Loading branch information
madpilot78 committed Oct 17, 2021
1 parent 21d79d6 commit c43e12a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion emulators/virtualbox-ose-legacy/Makefile
Expand Up @@ -2,7 +2,7 @@

PORTNAME= virtualbox-ose
PORTVERSION= 5.2.44
PORTREVISION= 8
PORTREVISION= 9
CATEGORIES= emulators
MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/
PKGNAMESUFFIX?= -legacy
Expand Down
@@ -1,18 +1,6 @@
--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c.orig 2020-07-09 16:50:11 UTC
--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c.orig 2021-07-28 16:16:27 UTC
+++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c
@@ -1,10 +1,6 @@
-/* $Id: vboxvfs_vnops.c $ */
-/** @file
- * Description.
- */
-
/*
* Copyright (C) 2008-2017 Oracle Corporation
+ * Copyright (C) 2017 Mahdi Mokhtari
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -14,228 +10,1347 @@
@@ -14,228 +14,1354 @@
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
Expand Down Expand Up @@ -172,6 +160,9 @@
+ .vop_write = vboxfs_write,
+ .vop_bmap = VOP_EOPNOTSUPP
};
+#if __FreeBSD_version > 1300068
+VFS_VOP_VECTOR_REGISTER(vboxfs_vnodeops);
+#endif

-static int vboxvfs_access(struct vop_access_args *ap)
+static uint64_t
Expand Down Expand Up @@ -1128,7 +1119,7 @@
+ struct vnode *vp = ap->a_vp;
+ struct uio *uio = ap->a_uio;
+ struct vboxfs_node *dir = VP_TO_VBOXFS_NODE(vp);
+ struct vboxfs_node *node;
+ struct vboxfs_node *node = NULL;
+ struct sffs_dirent *dirent = NULL;
+ sffs_dirents_t *cur_buf;
+ off_t offset = 0;
Expand Down Expand Up @@ -1406,7 +1397,11 @@
+ cnp->cn_flags & DOWHITEOUT &&
+ cnp->cn_flags & ISWHITEOUT))) {
+ error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred,
+#if __FreeBSD_version < 1400037
+ cnp->cn_thread);
+#else
+ curthread);
+#endif
+ if (error != 0)
+ goto out;
+
Expand Down

0 comments on commit c43e12a

Please sign in to comment.