# HG changeset patch
# User Ivo Smits
# Date 1304519530 -7200
# Node ID b0033e69105a23df053eaa522336f10492361754
# Parent f1deea9c97a020903d67b31d74e3e95a6a63ff9a
Set group ID during initialization, added a patch to mono to fix a double free 'bug'
diff -r f1deea9c97a0 -r b0033e69105a VBoxFrontend/MonoCOMInteropDoubleFree.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/VBoxFrontend/MonoCOMInteropDoubleFree.patch Wed May 04 16:32:10 2011 +0200
@@ -0,0 +1,17 @@
+diff --git a/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs b/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs
+index 54fefe2..1271257 100644
+--- a/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs
++++ b/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs
+@@ -93,12 +93,9 @@ namespace Mono.Interop
+ Marshal.ThrowExceptionForHR (hr);
+ ComInteropProxy obj = FindProxy (ppv);
+ if (obj == null) {
+- Marshal.Release (pItf);
+ return new ComInteropProxy (ppv);
+ }
+ else {
+- Marshal.Release (pItf);
+- System.Threading.Interlocked.Increment (ref obj.ref_count);
+ return obj;
+ }
+ }
diff -r f1deea9c97a0 -r b0033e69105a VBoxFrontend/ProgramLoader.cs
--- a/VBoxFrontend/ProgramLoader.cs Wed May 04 16:10:08 2011 +0200
+++ b/VBoxFrontend/ProgramLoader.cs Wed May 04 16:32:10 2011 +0200
@@ -26,7 +26,13 @@
private static void Unix_setuid() {
uint uid = Mono.Unix.Native.Syscall.getuid();
uint euid = Mono.Unix.Native.Syscall.geteuid();
- Console.WriteLine("Running as user {0} effective {1}", uid, euid);
+ uint gid = Mono.Unix.Native.Syscall.getgid();
+ uint egid = Mono.Unix.Native.Syscall.getegid();
+ Console.WriteLine("Running as user {0} effective {1} group {2} effective {3}", uid, euid, gid, egid);
+ if (gid != egid) {
+ Console.WriteLine("Set group ID: {0}", gid);
+ Mono.Unix.Native.Syscall.setregid(gid, gid);
+ }
if (uid != euid) {
Console.WriteLine("Set user ID: {0}", uid);
Mono.Unix.Native.Syscall.setreuid(uid, uid);
diff -r f1deea9c97a0 -r b0033e69105a VBoxFrontend/VBoxFrontend.csproj
--- a/VBoxFrontend/VBoxFrontend.csproj Wed May 04 16:10:08 2011 +0200
+++ b/VBoxFrontend/VBoxFrontend.csproj Wed May 04 16:32:10 2011 +0200
@@ -86,6 +86,9 @@
+
+
+