Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2002 12:43:56 +0200
From:      neologism <neologism@seznam.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/38986: a change to msdosfs permissions behaviour according to noexec
Message-ID:  <20020607124356.A599@variola>

next in thread | raw e-mail | index | archive | help

>Number:         38986
>Category:       kern
>Synopsis:       a change to msdosfs permissions behaviour according to noexec
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 07 09:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     neologism
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
>Environment:
System: FreeBSD variola 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Sat Jan 12 11:09:42 GMT 2002 root@:/usr/src/sys/compile/MYKERNEL i386

>Description:

Current implementation of permission checking in msdosfs doesn't reflect
setting of noexec at mount time. I'm sending a patch which changes this
behaviour. Now if noexec is set rights are set to 644 instead of 755.
I hope its done the right way.

>How-To-Repeat:

it is default behaviour

>Fix:

--- sys/msdosfs/msdosfs_vnops.c	Tue Jul 18 13:19:13 2000
+++ /root/msdosfs_vnops.c	Sat May 11 14:18:09 2002
@@ -354,10 +354,21 @@
 		fileid += dep->de_diroffset / sizeof(struct direntry);
 	}
 	vap->va_fileid = fileid;
-	if ((dep->de_Attributes & ATTR_READONLY) == 0)
-		mode = S_IRWXU|S_IRWXG|S_IRWXO;
-	else
-		mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
+	/*
+	 * Previously NOEXEC was used just in exec checking, rights were always
+	 * shown with +x. This should prevent such behaviour
+	 */
+	if ((pmp->pm_mountp->mnt_flag & MNT_NOEXEC) == 0) {
+		if ((dep->de_Attributes & ATTR_READONLY) == 0)
+			mode = S_IRWXU|S_IRWXG|S_IRWXO;
+		else
+			mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
+	} else {
+		if ((dep->de_Attributes & ATTR_READONLY) == 0)
+			mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_WOTH;
+		else
+			mode = S_IRUSR|S_IRGRP|S_IROTH;
+	}
 	vap->va_mode = mode & pmp->pm_mask;
 	vap->va_uid = pmp->pm_uid;
 	vap->va_gid = pmp->pm_gid;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020607124356.A599>