mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: kernel test robot <rong.a.chen@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Waiman Long <longman@redhat.com>,
	1vier1@web.de, Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jonathan Corbet <corbet@lwn.net>,
	lkp@lists.01.org, ltp@lists.linux.it
Subject: Re: [ipc/sem.c] 6394de3b86: BUG:kernel_NULL_pointer_dereference,address
Date: Wed, 23 Oct 2019 20:28:52 +0200	[thread overview]
Message-ID: <d49d1940-a704-d79e-b44f-79db9f096d5c@colorfullife.com> (raw)
In-Reply-To: <20191021083514.GE9296@shao2-debian>

Hello,

On 10/21/19 10:35 AM, kernel test robot wrote:
> FYI, we noticed the following commit (built with gcc-7):
>
> commit: 6394de3b868537a90dd9128607192b0e97109f6b ("[PATCH 4/5] ipc/sem.c: Document and update memory barriers")
> url: https://github.com/0day-ci/linux/commits/Manfred-Spraul/wake_q-Cleanup-Documentation-update/20191014-055627

Yes, known issue:

> @@ -2148,9 +2176,11 @@ static long do_semtimedop(int semid, struct 
> sembuf __user *tsops,
>         }
>
>         do {
> -               WRITE_ONCE(queue.status, -EINTR);
> +               /* memory ordering ensured by the lock in sem_lock() */
> +               queue.status = EINTR;
>                 queue.sleeper = current;
>
> +               /* memory ordering is ensured by the lock in sem_lock() */
>                 __set_current_state(TASK_INTERRUPTIBLE);
>                 sem_unlock(sma, locknum);
>                 rcu_read_unlock();
It must be "-EINTR", not "EINTR".

If there is a timeout or a spurious wakeup, then the do_semtimedop() 
returns to user space without unlinking everything properly.

I was able to reproduce the issue: V1 of the series ends up with the 
shown error.

V3 as now merged doesn't fail.

--

     Manfred



  reply	other threads:[~2019-10-23 18:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 11:20 [PATCH 0/3] Clarify/standardize memory barriers for ipc Manfred Spraul
2019-10-11 11:20 ` [PATCH 1/5] wake_q: Cleanup + Documentation update Manfred Spraul
2019-10-11 11:20 ` [PATCH 2/5] ipc/mqueue.c: Update/document memory barriers Manfred Spraul
2019-10-11 16:55   ` Davidlohr Bueso
2019-10-11 18:53     ` Manfred Spraul
2019-10-14  6:29       ` Davidlohr Bueso
2019-10-11 11:20 ` [PATCH 3/5] ipc/msg.c: Update and document " Manfred Spraul
2019-10-11 11:20 ` [PATCH 4/5] ipc/sem.c: Document and update " Manfred Spraul
2019-10-21  8:35   ` [ipc/sem.c] 6394de3b86: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2019-10-23 18:28     ` Manfred Spraul [this message]
2019-10-11 11:20 ` [PATCH 5/5] Documentation/memory-barriers.txt: Clarify cmpxchg() 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=d49d1940-a704-d79e-b44f-79db9f096d5c@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=1vier1@web.de \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@lists.01.org \
    --cc=longman@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=peterz@infradead.org \
    --cc=rong.a.chen@intel.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

all inboxes | Powered by JetHome®