mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu
Subject: Re: [patch] sched-2.5.24-D3, batch/idle priority scheduling, SCHED_BATCH
Date: Thu, 11 Jul 2002 02:34:16 +0400	[thread overview]
Message-ID: <3D2CB668.8CC739B6@tv-sign.ru> (raw)

Hello.

> > > > And users of __KERNEL_SYSCALLS__ and kernel_thread() should not
> > > > have policy == SCHED_BATCH.
> >
> > well, there's one security consequence here - module loading
> > (request_module()), which spawns a kernel thread must not run as
> > SCHED_BATCH. I think the right solution for that path is to set the
> > policy to SCHED_OTHER upon entry, and restore it to the previous one
> > afterwards - this way the helper thread has SCHED_OTHER priority.
>
> i've solved this problem by making kernel_thread() spawned threads drop
> back to SCHED_NORMAL:

Note that request_module() also does waitpid(). So it's better to change
policy upon entry, as You suggested.

> I believe this is the secure way of doing it - independently of
> SCHED_BATCH - a RT task should not spawn a RT kernel thread 'unwillingly'.

Yes, but this semantic change should be ported to all archs
independently of
low level microoptimizations, for consistency. Rename all definitions to
arch_kernel_thread() ?

Btw, how about this tiny bit of cleanup:

asmlinkage void schedule_userspace(void)
{
    /*
     * Only handle batch tasks that are runnable.
     */
    if (current->policy == SCHED_BATCH &&
        current->state == TASK_RUNNING) {
        runqueue_t *rq = this_rq_lock();
        deactivate_batch_task(current, rq);

        // we can keep irqs disabled:
        spin_unlock(&rq->lock);
    }

    schedule();
}

Oleg.

             reply	other threads:[~2002-07-10 22:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10 22:34 Oleg Nesterov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-06 18:18 oleg
2002-07-10 19:38 ` Ingo Molnar
2002-07-10 19:46   ` Ingo Molnar
2002-07-11  7:15     ` Ingo Molnar
2002-07-14 12:29       ` Pavel Machek
2002-07-15 16:31         ` Robert Love
2002-07-18  6:46         ` Ingo Molnar
2002-07-01  9:45 Ingo Molnar

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=3D2CB668.8CC739B6@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®