linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.5.63 - if/ifdef janitor work - actual bug found..
@ 2003-02-27 19:46 Valdis.Kletnieks
  2003-02-27 20:42 ` Thomas Molina
  0 siblings, 1 reply; 4+ messages in thread
From: Valdis.Kletnieks @ 2003-02-27 19:46 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

The previous patches cleaned things up enough that -Wundef doesn't trigger
a lot of false positives.. which made this one visible.  There's no other
occurrence of MAX_OWNER_OVERRIDE in the tree, and it's obviously not
MAY_OWNER_OVERRIDE either.  Looks like just remaindered cruft that I've
cleaned up....

--- include/linux/nfsd/nfsd.h.dist	2003-02-24 14:06:01.000000000 -0500
+++ include/linux/nfsd/nfsd.h	2003-02-27 00:21:53.957428476 -0500
@@ -39,7 +39,7 @@
 #define MAY_LOCK		32
 #define MAY_OWNER_OVERRIDE	64
 #define	MAY_LOCAL_ACCESS	128 /* IRIX doing local access check on device special file*/
-#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAX_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
+#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
 # error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_OWNER_OVERRIDE."
 #endif
 #define MAY_CREATE		(MAY_EXEC|MAY_WRITE)



[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.5.63 - if/ifdef janitor work - actual bug found..
  2003-02-27 19:46 2.5.63 - if/ifdef janitor work - actual bug found Valdis.Kletnieks
@ 2003-02-27 20:42 ` Thomas Molina
  2003-02-27 21:02   ` [UPDATED PATCH] " Valdis.Kletnieks
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Molina @ 2003-02-27 20:42 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Linux Kernel Mailing List

On Thu, 27 Feb 2003 Valdis.Kletnieks@vt.edu wrote:

> The previous patches cleaned things up enough that -Wundef doesn't trigger
> a lot of false positives.. which made this one visible.  There's no other
> occurrence of MAX_OWNER_OVERRIDE in the tree, and it's obviously not
> MAY_OWNER_OVERRIDE either.  Looks like just remaindered cruft that I've
> cleaned up....
> 
> --- include/linux/nfsd/nfsd.h.dist	2003-02-24 14:06:01.000000000 -0500
> +++ include/linux/nfsd/nfsd.h	2003-02-27 00:21:53.957428476 -0500
> @@ -39,7 +39,7 @@
>  #define MAY_LOCK		32
>  #define MAY_OWNER_OVERRIDE	64
>  #define	MAY_LOCAL_ACCESS	128 /* IRIX doing local access check on device special file*/
> -#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAX_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
> +#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
>  # error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_OWNER_OVERRIDE."
>  #endif
>  #define MAY_CREATE		(MAY_EXEC|MAY_WRITE)


Why couldn't it be MAY_OWNER_OVERRIDE??? There are occurrences of 
MAY_OWNER_OVERRIDE
What about the following in fs/nfsd/vfs.c ??

/*
 * Set various file attributes.
 * N.B. After this call fhp needs an fh_put
 */
int
nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr 
*iap,
             int check_guard, time_t guardtime)
{
        struct dentry   *dentry;
        struct inode    *inode;
        int             accmode = MAY_SATTR;
        int             ftype = 0;
        int             imode;
        int             err;
        int             size_change = 0;

        if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
                accmode |= MAY_WRITE|MAY_OWNER_OVERRIDE;
        if (iap->ia_valid & ATTR_SIZE)
                ftype = S_IFREG;


Or this ???

        /* The size case is special. It changes the file as well as the 
attributes.  */
        if (iap->ia_valid & ATTR_SIZE) {
                if (iap->ia_size < inode->i_size) {
                        err = nfsd_permission(fhp->fh_export, dentry, 
MAY_TRUNC|MAY_OWNER_OVERRIDE);
                        if (err)
                                goto out;
                }


Or this ???

        /*
         * If we get here, then the client has already done an "open",
         * and (hopefully) checked permission - so allow OWNER_OVERRIDE
         * in case a chmod has now revoked permission.
         */
        err = fh_verify(rqstp, fhp, type, access | MAY_OWNER_OVERRIDE);
        if (err)
                goto out;





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [UPDATED PATCH] Re: 2.5.63 - if/ifdef janitor work - actual bug found..
  2003-02-27 20:42 ` Thomas Molina
@ 2003-02-27 21:02   ` Valdis.Kletnieks
  2003-02-28 14:17     ` Bill Davidsen
  0 siblings, 1 reply; 4+ messages in thread
From: Valdis.Kletnieks @ 2003-02-27 21:02 UTC (permalink / raw)
  To: Thomas Molina; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

On Thu, 27 Feb 2003 14:42:50 CST, Thomas Molina said:

> Why couldn't it be MAY_OWNER_OVERRIDE??? There are occurrences of 
> MAY_OWNER_OVERRIDE

Yes, but then the logic becomes:

#if (a | b | MAY_OWNER_OVERRIDE) & (c | d | MAY_OWNER_OVERRIDE)
#error ....
#endif
 
so it will *alway* error out.  Tried it, it #errored, I looked at it
more closely.  The logic there is that it wants to have the two sets
(SATTR, TRUNC, LOCK, LOCAL_ACCESS) and (READ, WRITE, EXEC, OVERRIDE) 
as disjoint sets of bits.

And yes, somebody else pointed out that the #error test probably needs
to be cleaned up too..

/Valdis

--- include/linux/nfsd/nfsd.h.dist	2003-02-24 14:06:01.000000000 -0500
+++ include/linux/nfsd/nfsd.h	2003-02-27 16:01:59.000000000 -0500
@@ -39,8 +39,8 @@
 #define MAY_LOCK		32
 #define MAY_OWNER_OVERRIDE	64
 #define	MAY_LOCAL_ACCESS	128 /* IRIX doing local access check on device special file*/
-#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAX_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
-# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_OWNER_OVERRIDE."
+#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_OWNER_OVERRIDE)
+# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_LOCAL_ACCESS."
 #endif
 #define MAY_CREATE		(MAY_EXEC|MAY_WRITE)
 #define MAY_REMOVE		(MAY_EXEC|MAY_WRITE|MAY_TRUNC)


[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [UPDATED PATCH] Re: 2.5.63 - if/ifdef janitor work - actual bug found..
  2003-02-27 21:02   ` [UPDATED PATCH] " Valdis.Kletnieks
@ 2003-02-28 14:17     ` Bill Davidsen
  0 siblings, 0 replies; 4+ messages in thread
From: Bill Davidsen @ 2003-02-28 14:17 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Thomas Molina, Linux Kernel Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 937 bytes --]

On Thu, 27 Feb 2003 Valdis.Kletnieks@vt.edu wrote:

> On Thu, 27 Feb 2003 14:42:50 CST, Thomas Molina said:
> 
> > Why couldn't it be MAY_OWNER_OVERRIDE??? There are occurrences of 
> > MAY_OWNER_OVERRIDE
> 
> Yes, but then the logic becomes:
> 
> #if (a | b | MAY_OWNER_OVERRIDE) & (c | d | MAY_OWNER_OVERRIDE)
> #error ....
> #endif
>  
> so it will *alway* error out.  Tried it, it #errored, I looked at it
> more closely.  The logic there is that it wants to have the two sets
> (SATTR, TRUNC, LOCK, LOCAL_ACCESS) and (READ, WRITE, EXEC, OVERRIDE) 
> as disjoint sets of bits.

Thanks for that clarification, I had kept the original message to ask the
same question. Actually, while you are fixing this, how about putting in a
comment line saying what you just told us? It makes reading the code much
easier!

-- 
bill davidsen <davidsen@tmr.com>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

[-- Attachment #2: Type: APPLICATION/PGP-SIGNATURE, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-28 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-27 19:46 2.5.63 - if/ifdef janitor work - actual bug found Valdis.Kletnieks
2003-02-27 20:42 ` Thomas Molina
2003-02-27 21:02   ` [UPDATED PATCH] " Valdis.Kletnieks
2003-02-28 14:17     ` Bill Davidsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).