From nobody@FreeBSD.org  Thu Jan 15 12:21:44 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0CB4F106571B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 15 Jan 2009 12:21:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E3D248FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 15 Jan 2009 12:21:43 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n0FCLhLC078722
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 15 Jan 2009 12:21:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n0FCLhrr078721;
	Thu, 15 Jan 2009 12:21:43 GMT
	(envelope-from nobody)
Message-Id: <200901151221.n0FCLhrr078721@www.freebsd.org>
Date: Thu, 15 Jan 2009 12:21:43 GMT
From: Lawrence Stewart <lstewart@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] emulators/open-vm-tools does not compile on 8-CURRENT
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         130583
>Category:       ports
>Synopsis:       [patch] emulators/open-vm-tools does not compile on 8-CURRENT
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    mbr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 15 12:30:04 UTC 2009
>Closed-Date:    Tue Mar 03 23:27:19 UTC 2009
>Last-Modified:  Tue Mar  3 23:30:03 UTC 2009
>Originator:     Lawrence Stewart
>Release:        8-CURRENT
>Organization:
>Environment:
FreeBSD freebsd8-i386-clean.loshell.home 8.0-CURRENT FreeBSD 8.0-CURRENT #0 r187214: Thu Jan 15 00:16:11 EST 2009     root@freebsd8-i386-clean.loshell.room52.net:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
The currently used suser(9) KPI was removed a while ago. The replacement is priv_check(9).

The "a_mode" member of struct vop_access_args has been renamed to "a_accmode".

Both of these issues stop the vmhgfs and vmblock FreeBSD kernel drivers from building as part of the port build on recent 8-CURRENT.
>How-To-Repeat:
cd /usr/ports/emulators/open-vm-tools && make

(note the problem is also present with emulators/open-vm-tools-nox11)
>Fix:
Attached patch renames struct vop_access_args member "a_mode" to "a_accmode", and updates suser(9) calls to priv_check(9). Privs checked for are a guess based on code comments and the contents of sys/sys/priv.h and should be reviewed to make sure I picked the correct ones to check for.

I've done no other validation than to check it compiles and the modules load correctly into the kernel. I don't use the functionality of either module as far as I'm aware so I can't vouch for the correctness of my changes.

It may also be possible to indirect through a compat layer to avoid the patch altogether... not sure as I haven't investigated this at all. Probably best to go with some sort of patch though to future proof the fix.

Patch attached with submission follows:

--- modules/freebsd/vmhgfs/vfsops.c.orig	2009-01-15 22:29:18.000000000 +1100
+++ modules/freebsd/vmhgfs/vfsops.c	2009-01-15 22:29:43.000000000 +1100
@@ -139,7 +139,7 @@
     * Since Hgfs requires the caller to be root, only allow mount attempts made
     * by the superuser.
     */
-   if ((ret = suser(td)) != 0) {
+   if ((ret = priv_check(td, PRIV_VFS_MOUNT)) != 0) {
       return ret;
    }
 
--- modules/freebsd/vmhgfs/vnops.c.orig	2009-01-15 22:28:42.000000000 +1100
+++ modules/freebsd/vmhgfs/vnops.c	2009-01-15 22:28:53.000000000 +1100
@@ -352,7 +352,7 @@
 */
 {
    struct vnode *vp = ap->a_vp;
-   int mode = ap->a_mode;
+   int mode = ap->a_accmode;
 
    return HgfsAccessInt(vp, mode);
 }
--- modules/freebsd/vmblock/vnops.c.orig	2009-01-15 22:29:59.000000000 +1100
+++ modules/freebsd/vmblock/vnops.c	2009-01-15 22:30:29.000000000 +1100
@@ -723,7 +723,7 @@
        * NB:  Allowing only the superuser to open this directory breaks
        *      readdir() of the filesystem root for non-privileged users.
        */
-      if ((retval = suser(ap->a_td)) == 0) {
+      if ((retval = priv_check(ap->a_td, PRIV_VFS_GETFH)) == 0) {
 #if __FreeBSD_version >= 700000
          fp = ap->a_fp;
 #else
@@ -1007,7 +1007,7 @@
 */
 {
    struct vnode *vp = ap->a_vp;
-   mode_t mode = ap->a_mode;
+   mode_t mode = ap->a_accmode;
 
    /*
     * Disallow write attempts on read-only layers; unless the file is a


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->mbr 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Jan 15 12:30:21 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=130583 

From: takahiro.kurosawa@gmail.com
To: bug-followup@FreeBSD.org, lstewart@FreeBSD.org
Cc:  
Subject: Re: ports/130583: [patch] emulators/open-vm-tools does not compile on 8-CURRENT
Date: Wed, 28 Jan 2009 10:59:23 +0900

 --Multipart_Wed_Jan_28_10:59:23_2009-1
 Content-Type: text/plain; charset=US-ASCII
 
 vmhgfs (and vmblock probably) also needs the attached patch on
 FreeBSD >=7.0-RELEASE.
 Without the patch, the kernel crashes when vmhgfs is accessed.
 I've tested it for vmhgfs on VMWare Player 2.5, but not for vmblock.
 
 
 --Multipart_Wed_Jan_28_10:59:23_2009-1
 Content-Type: text/plain; charset=US-ASCII
 Content-Disposition: inline; filename="patch-insmntque"
 Content-Transfer-Encoding: 7bit
 
 --- modules/freebsd/vmblock/subr.c	Tue Jan 27 17:52:53 2009 +0900
 +++ modules/freebsd/vmblock/subr.c	Tue Jan 27 19:15:43 2009 +0900
 @@ -372,6 +372,13 @@
        return error;
     }
  
 +#if __FreeBSD_version >= 700034
 +   if ((error = insmntque(vp, mp)) != 0) {
 +      free(xp, M_VMBLOCKFSNODE);
 +      return error;
 +   }
 +#endif
 +
     xp->backVnode = vp;
     xp->lowerVnode = lowervp;
     vp->v_type = lowervp->v_type;
 --- modules/freebsd/vmhgfs/state.c	Tue Jan 27 17:52:53 2009 +0900
 +++ modules/freebsd/vmhgfs/state.c	Tue Jan 27 19:15:43 2009 +0900
 @@ -1067,6 +1067,12 @@
      */
     compat_lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, curthread);
  
 +#if __FreeBSD_version >= 700034
 +   if ((ret = insmntque(vp, vfsp)) != 0) {
 +      return ret;
 +   }
 +#endif
 +
     /*
      * Now we'll initialize the vnode.  We need to set the file type, vnode
      * operations, flags, filesystem pointer, reference count, and device.
 
 --Multipart_Wed_Jan_28_10:59:23_2009-1--
State-Changed-From-To: open->closed 
State-Changed-By: mbr 
State-Changed-When: Tue Mar 3 23:26:58 UTC 2009 
State-Changed-Why:  
Committed, thanks ! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=130583 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/130583: commit references a PR
Date: Tue,  3 Mar 2009 23:26:25 +0000 (UTC)

 mbr         2009-03-03 23:26:15 UTC
 
   FreeBSD ports repository
 
   Modified files:
     emulators/open-vm-tools Makefile distinfo pkg-plist 
     emulators/open-vm-tools/files patch-guestd-Makefile 
   Added files:
     emulators/open-vm-tools/files patch-freebsd-8 
                                   patch-services-Makefile 
                                   patch-suspend-vm-default 
                                   patch-vmblock-fuse-Makefile 
                                   patch-vmblock-fuse-block.c 
                                   patch-vmblock-subr.c 
                                   patch-vmhgfs-state.c 
   Removed files:
     emulators/open-vm-tools/files optpatch-nox11 
                                   patch-hgfsmounter-Makefile 
                                   patch-modules-Makefile 
                                   patch-toolbox-Makefile 
                                   patch-wiperPosix.c 
   Log:
   Upgrade the port to build 148847 from 2009.02.18.
   
   PR:             ports/130583
   Submitted by:   lstewart
   Reviewed by:    KUROSAWA Takahiro <takahiro.kurosawa@gmail.com>
   
   Revision  Changes    Path
   1.20      +13 -12    ports/emulators/open-vm-tools/Makefile
   1.5       +3 -3      ports/emulators/open-vm-tools/distinfo
   1.2       +0 -11     ports/emulators/open-vm-tools/files/optpatch-nox11 (dead)
   1.1       +54 -0     ports/emulators/open-vm-tools/files/patch-freebsd-8 (new)
   1.2       +14 -14    ports/emulators/open-vm-tools/files/patch-guestd-Makefile
   1.2       +0 -58     ports/emulators/open-vm-tools/files/patch-hgfsmounter-Makefile (dead)
   1.2       +0 -63     ports/emulators/open-vm-tools/files/patch-modules-Makefile (dead)
   1.1       +24 -0     ports/emulators/open-vm-tools/files/patch-services-Makefile (new)
   1.1       +26 -0     ports/emulators/open-vm-tools/files/patch-suspend-vm-default (new)
   1.3       +0 -40     ports/emulators/open-vm-tools/files/patch-toolbox-Makefile (dead)
   1.1       +35 -0     ports/emulators/open-vm-tools/files/patch-vmblock-fuse-Makefile (new)
   1.1       +14 -0     ports/emulators/open-vm-tools/files/patch-vmblock-fuse-block.c (new)
   1.1       +16 -0     ports/emulators/open-vm-tools/files/patch-vmblock-subr.c (new)
   1.1       +15 -0     ports/emulators/open-vm-tools/files/patch-vmhgfs-state.c (new)
   1.2       +0 -32     ports/emulators/open-vm-tools/files/patch-wiperPosix.c (dead)
   1.16      +21 -0     ports/emulators/open-vm-tools/pkg-plist
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
