mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kuznet@ms2.inr.ac.ru
To: willy.LKml@free.FR (Willy Tarreau)
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG] 2.2.1[78] : RTNETLINK lock not properly locking ?
Date: Wed, 22 Nov 2000 21:09:03 +0300 (MSK)	[thread overview]
Message-ID: <200011221809.VAA20851@ms2.inr.ac.ru> (raw)
In-Reply-To: <974885943.3a1b9437847da@imp.free.fr> from "Willy Tarreau" at Nov 22, 0 12:45:00 pm

Hello!

>    - it will nearly never allow concurrent accesses (seems to be what was
>      intented when it was written)

Never, to be more exact. Concurrent accesses are allowed only with rtnetlink.

In 2.4 it is always exclusive, because shared access turned out to
be mostly useless.


>    - it will not always prevent concurrent accesses, which is weird because
>      rtnl_lock() only relies on rtnl_shlock() (and exlock, which is empty) to
>      protect sensible areas

It is linux-2.2, guy. 8) "threads" are not threaded there.

Semaphores (rtnl_lock, particularly) protects only areas, which
are going to _schedule_ excplicitly or implicitly.


> ok, Dave. But the code in dev_ioctl() actually is :
> 
>   rtnl_lock();
>   ret = dev_ifsioc(&ifr, cmd);
>   rtnl_unlock();
> 
> if only these lock/unlock guarantee this atomicity, then I can't
> see why my A,B,C case could not work. If this is because the
> kernel has been locked somewhere else, then why are the locks
> still needed ?

Please, read comments. People used to consider comments as something
decorative, but they are not. 

The first group of ioctls (no lock!):

		/*
		 *	These ioctl calls:
		 *	- can be done by all.
		 *	- atomic and do not require locking.
		 *	- return a value
		 */


The second group of ioctls (locked):

		/*
		 *	These ioctl calls:
		 *	- require superuser power.
		 *	- require strict serialization.
		 *	- do not return a value
		 */

Any questions?


>	 The author of rtnetlink.h has been very precautious
> about the atomicity of these locks when CONFIG_RTNETLINK is set.

Sorry...

/* NOTE: these locks are not interrupt safe, are not SMP safe,
 * they are even not atomic. 8)8)8) ... and it is not a bug.
etc.

Do you call this "very precautios"? 8)

I would say that I was absolutely careless about their atomicity
because it is useless before BKL has been removed.

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

  parent reply	other threads:[~2000-11-22 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-22 11:27 Willy Tarreau
2000-11-22  9:39 ` Willy Tarreau
2000-11-22  9:46   ` David S. Miller
2000-11-22 11:27     ` David S. Miller
2000-11-22 15:36       ` Willy Tarreau
2000-11-22 18:09   ` kuznet [this message]
2000-11-23  6:14     ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200011221809.VAA20851@ms2.inr.ac.ru \
    --to=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy.LKml@free.FR \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®