From andy@lysaker.kvaerner.no Wed Jan 15 22:17:57 MET 1997
Article: 7088 of linux.dev.kernel
Newsgroups: linux.dev.kernel
Path: knorke.saar.de!wg.saar.de!news.coli.uni-sb.de!news.phil.uni-sb.de!news.fh-hannover.de!comnets.rwth-aachen.de!ratatosk.yggdrasil.com!vger.gate.yggdrasil.com!not-for-mail
Approved: linux-kernel@vger.rutgers.edu
References: <5bikqs$114@sobolev.rhein.de>
X-Env-Sender: owner-linux-kernel-outgoing@vger.rutgers.edu
X-Hdr-Sender: andy@lysaker.kvaerner.no 
From: andy@lysaker.kvaerner.no (Andrew Walker)
Message-ID: <9701151445.AA06550@lysaker.kvaerner.no>
Subject: Re: 2.0.28: NFS caching fix did not make it
Date: Wed, 15 Jan 1997 15:40:24 +0100 (MET)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Submitted-Via: news@ratatosk.yggdrasil.com (linux.* gateway)
Sender: owner-linux-kernel@vger.rutgers.edu
Lines: 43

Thomas Roessler wrote:
> 
> 
> In article <5bge7v$8et$1@miriam.fuller.edu>, Christoph Lameter wrote:
> >There was a NFS fix posted by Olaf Kirch that did not make it into 2.0.28:
> >This is very important since most locking over NFS is done this way.
> 
> A propos locking - how about the flock(2) semantics which are broken in
> 2.0.27 (LOCK_EX is possible even if the locking process can't write to the
> file being locked)?  I don't see any patches to the relevant parts of the
> kernel source, and this *is* a relevant issue.  See also the
> denial-of-service attacks against various getties and login programs.
> 
> tlr
> -- 
> Thomas Roessler                  	  http://home.pages.de/~roessler/
> 

No! No! No! Denying LOCK_EX doesn't solve the problem, and isn't correct
BSD semantics either. You only need a LOCK_SH on wtmp to block the current
login/getty implementations indefinitely anyway. login & getty should be
fixed. flock() isn't broken the way it is.

- if login/getty are to lock the wtmp file at all, they should do so
  with fcntl()/lockf(), which already have the semantics you're asking
  for.

- even this won't help, because a F_RDLCK on wtmp will block login/getty's
  F_WRLCK.

- login/getty don't need to lock the wtmp file anyway, they can just open
  it with O_WRONLY|O_APPEND. This is what SunOS 4.1.x and BSD do. I'm just
  about to check what Solaris does (gotta compile strace first).

-Andy

-- 
Andy Walker                              Kvaerner Engineering a.s.
Andrew.Walker@lysaker.kvaerner.no        P.O. Box 222, N-1324 Lysaker, Norway

   ......if the answer isn't violence, neither is your silence......

(pwei barmy army - oslo "filial")


