mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
Cc: "Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [Regression] 2.6.24-git9: RT sched mishandles artswrapper (bisected)
Date: Wed, 6 Feb 2008 02:21:20 +0100	[thread overview]
Message-ID: <200802060221.21824.rjw@sisk.pl> (raw)
In-Reply-To: <b647ffbd0802051346k563a44f7t42739515c130124b@mail.gmail.com>

On Tuesday, 5 of February 2008, Dmitry Adamushko wrote:
> Rafael, any progress with this issue? (a few questions below).
> 
> > >
> > > Does this artsmessage thing also run with RT priority?
> >
> > Well, it's in a strange state (after it's broken).  From top:
> >
> > PR = -51
> > NI = 0
> > S = R
> > %CPU = 0.0
> > %MEM = 0.0
> 
> cat /proc/$PID/stat ; sleep 3; cat /proc/$PID/stat ?
> cat /proc/sched_debug; sleep 3 ; cat /proc/sched_debug

Well, instead please find appended a test program that allows me to trigger
the issue.

To reproduce it do:

$ gcc -o break_scheduler break_scheduler.c
$ su -
[...]
# chown root.root $PATH_TO_BINARY/break_scheduler
# chmod u+s $PATH_TO_BINARY/break_scheduler
^D
$ ./break_scheduler

It behaves normally if run directly by root and it also behaves normally if
the execv() at the end is removed.

Hope that helps to understand what the problem is.

Thanks,
Rafael

---
#include <stdio.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <sched.h>

#define EXECUTE "/bin/ls"

void adjust_priority()
{
	int sched = sched_getscheduler(0);

	if(sched == SCHED_FIFO || sched == SCHED_RR) {
		puts(">> non-standard scheduling policy");
	} else {
		struct sched_param sp;
		long int priority = (sched_get_priority_max(SCHED_FIFO) +
			             sched_get_priority_min(SCHED_FIFO))/2;
		
		sp.sched_priority = priority;

		if (sched_setscheduler(0, SCHED_FIFO, &sp) != -1) {
			printf(">> running as realtime process now "
				"(priority %ld)\n", priority);
		} else {
			/* can't set realtime priority */
			puts(">> could not set realtime priority");
		}
	}
}

int main(int argc, char **argv)
{
	adjust_priority();

	/* drop root privileges if running setuid root
	   (due to realtime priority stuff) */
	if (geteuid() != getuid()) {
		seteuid(getuid());
		if (geteuid() != getuid()) {
			perror("setuid()");
			return 2;
		}
	}

	puts("OK");

	if(argc == 0)
		return 1;

	argv[0] = EXECUTE;
	execv(EXECUTE, argv);
	perror(EXECUTE);

	return 0;
}

  reply	other threads:[~2008-02-06  1:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01  1:37 Rafael J. Wysocki
2008-02-01  2:04 ` Rafael J. Wysocki
2008-02-01  7:44   ` Peter Zijlstra
2008-02-01  9:50     ` Peter Zijlstra
2008-02-01 11:50       ` Rafael J. Wysocki
2008-02-01 12:09         ` Peter Zijlstra
2008-02-01 23:39           ` Rafael J. Wysocki
2008-02-05 21:46             ` Dmitry Adamushko
2008-02-06  1:21               ` Rafael J. Wysocki [this message]
     [not found] ` <b647ffbd0802060040wbfe16afq4355e8f4f31ab06b@mail.gmail.com>
     [not found]   ` <1202288548.19243.47.camel@lappy>
2008-02-06 18:25     ` Rafael J. Wysocki
2008-02-06 21:43       ` Peter Zijlstra
2008-02-06 21:50         ` Rafael J. Wysocki
2008-02-06 22:01           ` Peter Zijlstra
2008-02-06 22:18             ` Rafael J. Wysocki
2008-02-06 22:34               ` Peter Zijlstra
2008-02-06 23:31                 ` Rafael J. Wysocki
2008-02-06 23:34                   ` Ingo Molnar
2008-02-07 19:53                     ` Rafael J. Wysocki
2008-02-07 21:20                       ` Peter Zijlstra
2008-02-10 12:30                     ` Rafael J. Wysocki

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=200802060221.21824.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.adamushko@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®