trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tommi Rantala <tt.rantala@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>, Dave Jones <davej@redhat.com>,
	trinity@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: sched_rr_get_interval NULL pointer OOPS
Date: Mon, 27 Jan 2014 11:54:13 +0100	[thread overview]
Message-ID: <20140127105413.GC11314@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <CA+ydwtpvqv7pHFiQsPX+DeRyjKVvxvS2SKxXEttdT=PQr6qqFQ@mail.gmail.com>

On Fri, Jan 24, 2014 at 10:55:56PM +0200, Tommi Rantala wrote:
> Hello,
> 
> Trinity triggered the following bug in two separate qemu virtual
> machines after fuzzing v3.13-3995-g0dc3fd0 for a day or two. I have
> not been running Trinity in a while, so no idea if this is a
> regression or not.
> 
> If I'm reading this right, it's oopsing in kernel/sched/core.c:
> 
> SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
>     struct timespec __user *, interval)
> {
> ...
>     rq = task_rq_lock(p, &flags);
>     time_slice = p->sched_class->get_rr_interval(rq, p);   <==
>     task_rq_unlock(rq, p, &flags);
> ...


---
Subject: sched: make sched_class::get_rr_interval optional

Not all classes implement (or can implement) a useful get_rr_interval()
function, default to a 0 time-slice for them.

Reported-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
---
Index: linux-2.6/kernel/sched/core.c
===================================================================
--- linux-2.6.orig/kernel/sched/core.c
+++ linux-2.6/kernel/sched/core.c
@@ -4324,7 +4324,9 @@ SYSCALL_DEFINE2(sched_rr_get_interval, p
 		goto out_unlock;
 
 	rq = task_rq_lock(p, &flags);
-	time_slice = p->sched_class->get_rr_interval(rq, p);
+	time_slice = 0;
+	if (p->sched_class->get_rr_interval)
+		time_slice = p->sched_class->get_rr_interval(rq, p);
 	task_rq_unlock(rq, p, &flags);
 
 	rcu_read_unlock();

      parent reply	other threads:[~2014-01-27 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 20:55 sched_rr_get_interval NULL pointer OOPS Tommi Rantala
2014-01-24 21:00 ` Dave Jones
2014-01-27 10:54 ` Peter Zijlstra [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=20140127105413.GC11314@laptop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=trinity@vger.kernel.org \
    --cc=tt.rantala@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).