From owner-freebsd-bugs Fri Jun 7 9:10:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 28D0A37B404 for ; Fri, 7 Jun 2002 09:10:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g57GA2h35461; Fri, 7 Jun 2002 09:10:02 -0700 (PDT) (envelope-from gnats) Received: from email.seznam.cz (smtp.seznam.cz [212.80.76.43]) by hub.freebsd.org (Postfix) with SMTP id BF43C37B404 for ; Fri, 7 Jun 2002 09:01:37 -0700 (PDT) Received: (qmail 65021 invoked from network); 7 Jun 2002 16:01:28 -0000 Received: from ppp92.brno.worldonline.cz (HELO variola) (212.11.105.92) by smtp.seznam.cz with SMTP; 7 Jun 2002 16:01:28 -0000 Received: from roman by variola with local (Exim 3.13 #1 (Debian)) id 17GHDp-00009l-00 for ; Fri, 07 Jun 2002 12:43:57 +0200 Message-Id: <20020607124356.A599@variola> Date: Fri, 7 Jun 2002 12:43:56 +0200 From: neologism Reply-To: neologism@seznam.cz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/38986: a change to msdosfs permissions behaviour according to noexec Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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