From nobody@FreeBSD.org  Wed Aug 24 15:46:47 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C976E16A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 15:46:47 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9B78343D48
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 15:46:47 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j7OFkle5045474
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 15:46:47 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j7OFklea045473;
	Wed, 24 Aug 2005 15:46:47 GMT
	(envelope-from nobody)
Message-Id: <200508241546.j7OFklea045473@www.freebsd.org>
Date: Wed, 24 Aug 2005 15:46:47 GMT
From: Sten Spans <sten@blinkenlights.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NFS statfs corruption
X-Send-Pr-Version: www-2.3

>Number:         85268
>Category:       kern
>Synopsis:       NFS statfs corruption
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 24 15:50:07 GMT 2005
>Closed-Date:    Wed Aug 24 18:52:37 GMT 2005
>Last-Modified:  Wed Aug 24 18:52:37 GMT 2005
>Originator:     Sten Spans
>Release:        5.4-RELEASE-p1
>Organization:
Blinkenlights.nl
>Environment:
FreeBSD www1.enrtd.nl.easynet.net 5.4-RELEASE-p1 FreeBSD 5.4-RELEASE-p1 #7: Fri May 20 10:19:10 CEST 2005     root@www1.enrtd.nl.easynet.net:/usr/obj/usr/src/sys/WWW  i386

>Description:
Specifying the mount_nfs -r option causes an nfsmount to get 
MNT_NOEXEC in statfs f_flags. This causes quite a few problems.
Please note that the mount is nog actually noexec, it just
has the bit set in f_flags.
>How-To-Repeat:
I used the following test prog:

#include <stdlib.h>
#include <sys/param.h>
#include <sys/mount.h>

int main(int argc, char **argv) {

  struct statfs fs;

  if (statfs(argv[1], &fs) != 0)
        exit(EXIT_FAILURE);

  if (fs.f_flags & MNT_NOEXEC) {
       printf("noexec\n");
  } else {
       printf("exec\n");
  }
}


www1# gcc -o noexec noexec.c
www1# mount nfs3:/export/vol1/build/BUILDROOT-WWW /buildroot
www1# ./noexec /buildroot/
exec
www1# umount /buildroot/
www1# mount -o -r=32768 nfs3:/export/vol1/build/BUILDROOT-WWW /buildroot
www1# ./noexec /buildroot/
noexec

>Fix:
this probably is a kernel problem.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Wed Aug 24 18:47:06 GMT 2005 
State-Changed-Why:  

Duplicate of kern/80390. This was fixed by revision 1.174 of 
nfs_vfsops.c a few months ago and has been merged to RELENG_5 
(revision 1.158.2.4). 

It's a one-line change, so should be easy to apply locally if you 
don't want to upgrade to RELENG_5. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85268 
>Unformatted:
