Re: A new lockd patch

G. Allen Morris III (gam3@harpo.ixlabs.com)
Sun, 28 Feb 1999 10:07:47 -0800


This patch does not seem to be correct.

On a root squashed server you should end up with the permitions
of nobody and on a no root sqashed machine you will be able to
lock files you can't access.

If you set umask to 7 on a root squashed filesystem locks fail.
This patch needs to be removed.

Allen

>>>H.J. Lu said:
> Index: fs/lockd/svcsubs.c
> ===================================================================
> RCS file: /home/work/cvs/linux/linux/fs/lockd/svcsubs.c,v
> retrieving revision 1.1.1.6
> diff -u -p -r1.1.1.6 svcsubs.c
> --- fs/lockd/svcsubs.c 1998/07/29 19:20:00 1.1.1.6
> +++ fs/lockd/svcsubs.c 1998/10/21 04:15:33
> @@ -52,6 +52,8 @@ nlm_lookup_file(struct svc_rqst *rqstp,
> struct nlm_file *file;
> unsigned int hash;
> u32 nfserr;
> + uid_t saved_cr_uid;
> + struct svc_cred *cred;
>
> dprintk("lockd: nlm_file_lookup(%s/%u)\n",
> kdevname(u32_to_kdev_t(fh->fh_dev)), fh->fh_ino);
> @@ -80,11 +82,19 @@ nlm_lookup_file(struct svc_rqst *rqstp,
>
> /* Open the file. Note that this must not sleep for too long, else
> * we would lock up lockd:-) So no NFS re-exports, folks.
> + *
> + * We have to make sure we have the right credential to open
> + * the file.
> */
> + cred = &rqstp->rq_cred;
> + saved_cr_uid = cred->cr_uid;
> + cred->cr_uid = 0;
> if ((nfserr = nlmsvc_ops->fopen(rqstp, fh, &file->f_file)) != 0) {
> dprintk("lockd: open failed (nfserr %ld)\n", ntohl(nfserr));
> + cred->cr_uid = saved_cr_uid;
> goto out_free;
> }
> + cred->cr_uid = saved_cr_uid;
>
> file->f_next = nlm_files[hash];
> nlm_files[hash] = file;
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

---------------------------------
G. Allen Morris III

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/