public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nadia Derbey <Nadia.Derbey@bull.net>
To: Pierre Peiffer <Pierre.Peiffer@bull.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH -mm] IPC: fix error checking in all new xxx_lock() functions
Date: Thu, 11 Oct 2007 10:19:56 +0200	[thread overview]
Message-ID: <470DDCAC.4040302@bull.net> (raw)
In-Reply-To: <20071011100348.abc31218.Pierre.Peiffer@bull.net>

Pierre Peiffer wrote:
> In the new implementation of the [sem|shm|msg]_lock[_check]() routines,
> we use the return value of ipc_lock() in container_of() without any check.
> But ipc_lock may return a errcode. The use of this errcode in container_of()
> may alter this errcode, and we don't want this.
> 
> Today, there is no problem because the member used in these container_of()
> is the first member of its container (offset == 0), the errcode isn't changed
> then. But in the general case, we can't count on this assumption and this
> may lead later to a real bug if we don't correct this.
> 
> In fact, the proposed solution is simple and correct. But it has the drawback
> of adding one more check ('if' statement) in the chain: we do a first check in
> ipc_lock(), now in xxx_lock() and then one later in the caller of xxx_lock()
> That's why I send this as RFC, may be another approach could be considered.
> 

This is really what disturbs me this solution: the same check will be 
done several times. But is true that we have to do something.
So why not simply adding a BIG COMMENT before the msg_queue, sem_array 
and shmid_ds stating that the kern_ipc_perm should stay at the beinnign 
of the structure?

Will try to look for another solution.

Regards,
Nadia


      reply	other threads:[~2007-10-11  8:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11  8:03 [RFC][PATCH -mm] IPC: fix error checking in all new xxx_lock() functions Pierre Peiffer
2007-10-11  8:19 ` Nadia Derbey [this message]

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=470DDCAC.4040302@bull.net \
    --to=nadia.derbey@bull.net \
    --cc=Pierre.Peiffer@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    /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