linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* WARNING: lock held when returning to user space in set_property_atomic
@ 2018-12-30  6:21 syzbot
  2019-01-03  8:55 ` Maarten Lankhorst
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2018-12-30  6:21 UTC (permalink / raw)
  To: airlied, daniel, dri-devel, linux-kernel, maarten.lankhorst,
	maxime.ripard, sean, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    903b77c63167 Merge tag 'linux-kselftest-4.21-rc1' of git:/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12d0f553400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=53a2f2aa0b1f7606
dashboard link: https://syzkaller.appspot.com/bug?extid=6ea337c427f5083ebdf2
compiler:       gcc (GCC) 8.0.1 20180413 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=120d906f400000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1024673b400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com

RBP: 00007ffe369ca7a0 R08: 0000000000000001 R09: 00000000004009ce
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000

================================================
WARNING: lock held when returning to user space!
4.20.0+ #174 Not tainted
------------------------------------------------
syz-executor556/8153 is leaving the kernel with locks still held!
1 lock held by syz-executor556/8153:
  #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at:  
set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: WARNING: lock held when returning to user space in set_property_atomic
  2018-12-30  6:21 WARNING: lock held when returning to user space in set_property_atomic syzbot
@ 2019-01-03  8:55 ` Maarten Lankhorst
  2019-01-03  9:04   ` Dmitry Vyukov
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Lankhorst @ 2019-01-03  8:55 UTC (permalink / raw)
  To: syzbot, airlied, daniel, dri-devel, linux-kernel, maxime.ripard,
	sean, syzkaller-bugs

Op 30-12-2018 om 07:21 schreef syzbot:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit:    903b77c63167 Merge tag 'linux-kselftest-4.21-rc1' of git:/..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12d0f553400000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=53a2f2aa0b1f7606
> dashboard link: https://syzkaller.appspot.com/bug?extid=6ea337c427f5083ebdf2
> compiler:       gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=120d906f400000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1024673b400000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com
>
> RBP: 00007ffe369ca7a0 R08: 0000000000000001 R09: 00000000004009ce
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
> R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000
>
> ================================================
> WARNING: lock held when returning to user space!
> 4.20.0+ #174 Not tainted
> ------------------------------------------------
> syz-executor556/8153 is leaving the kernel with locks still held!
> 1 lock held by syz-executor556/8153:
>  #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at: set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462
>
>
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches

Just guessing..

Does this help?
-----
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index cd9bc0ce9be0..004191d01772 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -459,11 +459,11 @@ static int set_property_atomic(struct drm_mode_object *obj,
 	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
-	drm_modeset_acquire_init(&ctx, 0);
-
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
 		return -ENOMEM;
+
+	drm_modeset_acquire_init(&ctx, 0);
 	state->acquire_ctx = &ctx;
 retry:
 	if (prop == state->dev->mode_config.dpms_property) {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: WARNING: lock held when returning to user space in set_property_atomic
  2019-01-03  8:55 ` Maarten Lankhorst
@ 2019-01-03  9:04   ` Dmitry Vyukov
  2019-01-04 10:04     ` Tetsuo Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Vyukov @ 2019-01-03  9:04 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: syzbot, David Airlie, Daniel Vetter, DRI, LKML, maxime.ripard,
	sean, syzkaller-bugs

On Thu, Jan 3, 2019 at 9:55 AM Maarten Lankhorst
<maarten.lankhorst@linux.intel.com> wrote:
>
> Op 30-12-2018 om 07:21 schreef syzbot:
> > Hello,
> >
> > syzbot found the following crash on:
> >
> > HEAD commit:    903b77c63167 Merge tag 'linux-kselftest-4.21-rc1' of git:/..
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=12d0f553400000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=53a2f2aa0b1f7606
> > dashboard link: https://syzkaller.appspot.com/bug?extid=6ea337c427f5083ebdf2
> > compiler:       gcc (GCC) 8.0.1 20180413 (experimental)
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=120d906f400000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1024673b400000
> >
> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com
> >
> > RBP: 00007ffe369ca7a0 R08: 0000000000000001 R09: 00000000004009ce
> > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
> > R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000
> >
> > ================================================
> > WARNING: lock held when returning to user space!
> > 4.20.0+ #174 Not tainted
> > ------------------------------------------------
> > syz-executor556/8153 is leaving the kernel with locks still held!
> > 1 lock held by syz-executor556/8153:
> >  #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at: set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462
> >
> >
> > ---
> > This bug is generated by a bot. It may contain errors.
> > See https://goo.gl/tpsmEJ for more information about syzbot.
> > syzbot engineers can be reached at syzkaller@googlegroups.com.
> >
> > syzbot will keep track of this bug report. See:
> > https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.
> > syzbot can test patches for this bug, for details see:
> > https://goo.gl/tpsmEJ#testing-patches
>
> Just guessing..
>
> Does this help?

Hi Maarten,

Please either test or ask syzbot to test:
https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches

> -----
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index cd9bc0ce9be0..004191d01772 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -459,11 +459,11 @@ static int set_property_atomic(struct drm_mode_object *obj,
>         struct drm_modeset_acquire_ctx ctx;
>         int ret;
>
> -       drm_modeset_acquire_init(&ctx, 0);
> -
>         state = drm_atomic_state_alloc(dev);
>         if (!state)
>                 return -ENOMEM;
> +
> +       drm_modeset_acquire_init(&ctx, 0);
>         state->acquire_ctx = &ctx;
>  retry:
>         if (prop == state->dev->mode_config.dpms_property) {
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/fea9b565-06e4-fbb5-7e92-efd133a7028c%40linux.intel.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: WARNING: lock held when returning to user space in set_property_atomic
  2019-01-03  9:04   ` Dmitry Vyukov
@ 2019-01-04 10:04     ` Tetsuo Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Tetsuo Handa @ 2019-01-04 10:04 UTC (permalink / raw)
  To: Dmitry Vyukov, Maarten Lankhorst, David Airlie, Daniel Vetter
  Cc: syzbot, DRI, LKML, maxime.ripard, sean, syzkaller-bugs

On 2019/01/03 18:04, Dmitry Vyukov wrote:
> On Thu, Jan 3, 2019 at 9:55 AM Maarten Lankhorst <maarten.lankhorst@linux.intel.com> wrote:
>> Just guessing..
>>
>> Does this help?

Yes it will. And while at it, let's fix another one together.

From 291e42211e3cc6d85c915772717dd08d40fb5fed Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Fri, 4 Jan 2019 15:23:47 +0900
Subject: [PATCH] gpu/drm: Fix lock held when returning to user space.

We need to call drm_modeset_acquire_fini() when drm_atomic_state_alloc()
failed or call drm_modeset_acquire_init() after drm_atomic_state_alloc()
succeeded.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot <syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 3 +--
 drivers/gpu/drm/drm_mode_object.c | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index c408898..9a1f41a 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1296,12 +1296,11 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 			(arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
 		return -EINVAL;
 
-	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
-
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
 		return -ENOMEM;
 
+	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 	state->acquire_ctx = &ctx;
 	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
 
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index cd9bc0c..004191d 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -459,11 +459,11 @@ static int set_property_atomic(struct drm_mode_object *obj,
 	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
-	drm_modeset_acquire_init(&ctx, 0);
-
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
 		return -ENOMEM;
+
+	drm_modeset_acquire_init(&ctx, 0);
 	state->acquire_ctx = &ctx;
 retry:
 	if (prop == state->dev->mode_config.dpms_property) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-04 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-30  6:21 WARNING: lock held when returning to user space in set_property_atomic syzbot
2019-01-03  8:55 ` Maarten Lankhorst
2019-01-03  9:04   ` Dmitry Vyukov
2019-01-04 10:04     ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).