public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	manfred <manfred@colorfullife.com>,
	Peter Zijlstra <peterz@infradead.org>,
	fabf@skynet.be, kernel@kyup.com,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>
Subject: Re: ipc: BUG: sem_unlock unlocks non-locked lock
Date: Sun, 18 Dec 2016 08:29:52 -0800	[thread overview]
Message-ID: <20161218162952.GB24788@linux-80c1.suse> (raw)
In-Reply-To: <20161218162838.GA24788@linux-80c1.suse>

On Sun, 18 Dec 2016, Bueso wrote:

>On Fri, 16 Dec 2016, Dmitry Vyukov wrote:
>
>>[ BUG: bad unlock balance detected! ]
>>4.9.0+ #89 Not tainted
>
>Thanks for the report, I can reproduce the issue as of (which I obviously
>should have tested with lockdep):
>
>370b262c896 (ipc/sem: avoid idr tree lookup for interrupted semop)
>
>I need to think more about it this evening, but I believe the issue to be
>the potentially bogus locknum in the unlock path, as we are calling sem_lock
>without updating the variable. I'll send a patch after more testing. This
>fixes it for me:
>
>diff --git a/ipc/sem.c b/ipc/sem.c
>index e08b94851922..fba6139e7208 100644
>--- a/ipc/sem.c
>+++ b/ipc/sem.c
>@@ -1977,7 +1977,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
>		}
>
>		rcu_read_lock();
>-		sem_lock(sma, sops, nsops);
>+	        sem_lock(sma, sops, nsops);

*sigh*, that would be:
	         locknum = sem_lock(sma, sops, nsops);

  reply	other threads:[~2016-12-18 16:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16  9:33 ipc: BUG: sem_unlock unlocks non-locked lock Dmitry Vyukov
2016-12-18 16:28 ` Davidlohr Bueso
2016-12-18 16:29   ` Davidlohr Bueso [this message]
2016-12-18 18:32     ` Manfred Spraul
2016-12-18 18:38       ` [PATCH] ipc/sem.c: fix semop()/semop() locking failure Manfred Spraul
2016-12-19  3:45         ` Davidlohr Bueso
2017-01-07  4:45           ` Mike Galbraith
2016-12-20  6:34       ` [PATCH v2] ipc/sem.c: fix incorrect sem_lock pairing Manfred Spraul

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=20161218162952.GB24788@linux-80c1.suse \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=fabf@skynet.be \
    --cc=kernel@kyup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=syzkaller@googlegroups.com \
    /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