linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Tycho Andersen <tycho.andersen@canonical.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>, Will Drewry <wad@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	"Serge E. Hallyn" <serge.hallyn@ubuntu.com>
Subject: Re: [PATCH] seccomp: add ptrace commands for suspend/resume
Date: Wed, 3 Jun 2015 10:11:43 -0700	[thread overview]
Message-ID: <CALCETrWq12bmire=XwaPCtiJs3-80McaZJzyVt3U5dTHge8LxQ@mail.gmail.com> (raw)
In-Reply-To: <20150603164121.GA19189@redhat.com>

On Wed, Jun 3, 2015 at 9:41 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> On 06/03, Tycho Andersen wrote:
>>
>> On Tue, Jun 02, 2015 at 08:28:29PM +0200, Oleg Nesterov wrote:
>> > On 06/01, Tycho Andersen wrote:
>> > >
>> > > --- a/include/linux/seccomp.h
>> > > +++ b/include/linux/seccomp.h
>> > > @@ -25,6 +25,9 @@ struct seccomp_filter;
>> > >  struct seccomp {
>> > >   int mode;
>> > >   struct seccomp_filter *filter;
>> > > +#ifdef CONFIG_CHECKPOINT_RESTORE
>> > > + bool suspended;
>> > > +#endif
>> >
>> > Then afaics you need to change copy_seccomp() to clear ->suspended.
>> > At least if the child is not traced.
>>
>> Yes, thank you.
>
> And if we really need to play with TIF_NOTSC, then copy_seccomp() should
> set it too if SUSPEND has cleared in parent's flags.
>
>> > But why do we bother to play with TIF_NOTSC, could you explain?
>>
>> The procedure for restoring is to call seccomp suspend, restore the
>> seccomp filters (and potentially other stuff), and then resume them at
>> the end. If the other stuff happens to use RDTSC, the process gets
>> killed because TIF_NOTSC has been set.
>
> This is clear, just I thought that CRIU doesn't use rdtsc on behalf of
> the traced task...
>
>> We can work around this in criu by doing the seccomp restore as the
>> very last thing before the final sigreturn,
>
> Not sure I understand... You need to suspend at "dump" time too afaics,
> otherwise, say, syscall_seized() can fail because this syscall is nacked
> by seccomp?
>
>> but that seems like the
>> seccomp suspend API is incomplete, IMO. However, since both you and
>> Andy complained, perhaps I should remove it :)
>
> Well, this is up to you ;)
>
> But. Note that a process can also disable TSC via PR_SET_TSC. So if
> dump or restore can't work without enabling TSC you probably want to
> handle this case too.
>
> And this makes me think that this needs a separate interface. I dunno.
>

True.  Or we could keep track of all the reasons the TSC is off.

--Andy

      parent reply	other threads:[~2015-06-03 17:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 19:28 [PATCH] seccomp: add ptrace commands for suspend/resume Tycho Andersen
     [not found] ` <1433186918-9626-1-git-send-email-tycho.andersen-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2015-06-01 19:38   ` Andy Lutomirski
     [not found]     ` <CALCETrVaE5UsTSQDf=48R8J9gG6YiMdp30wOMD+aZvxtOjrLRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-01 19:47       ` Tycho Andersen
2015-06-01 19:51         ` Andy Lutomirski
     [not found]           ` <CALCETrU2c99wQHfVS6Bi_7=sAYSr-gEUpRdgz=+FiGgGxbPyMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-01 20:12             ` Tycho Andersen
2015-06-02 15:46               ` Tycho Andersen
2015-06-01 20:00       ` Tycho Andersen
2015-06-02  9:36   ` Andrey Wagin
     [not found]     ` <CANaxB-zacYuo21jLVZyEfyf=UdDnTjYvHdgNpfL+c_DXWRz-eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-02 13:05       ` Tycho Andersen
2015-06-02 18:48         ` Oleg Nesterov
     [not found]           ` <20150602184848.GA24907-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-03 16:13             ` Tycho Andersen
2015-06-03 16:54               ` Oleg Nesterov
     [not found]                 ` <20150603165451.GA20911-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-03 16:58                   ` Tycho Andersen
2015-06-03 18:36                   ` Tycho Andersen
2015-06-02 18:28   ` Oleg Nesterov
     [not found]     ` <20150602182829.GA23449-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-02 19:02       ` Pavel Emelyanov
2015-06-02 19:24         ` Jann Horn
     [not found]         ` <556DFDB2.3050205-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2015-06-02 19:27           ` Andy Lutomirski
     [not found]             ` <CALCETrVYHYfogj3nTY-3ui87+tVi3mG3D4=Xdk-_MpisG8BczA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-03 14:45               ` Tycho Andersen
2015-06-02 21:27           ` Oleg Nesterov
2015-06-03 14:43       ` Tycho Andersen
2015-06-03 16:41         ` Oleg Nesterov
     [not found]           ` <20150603164121.GA19189-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-03 17:10             ` Tycho Andersen
2015-06-03 17:11           ` Andy Lutomirski [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='CALCETrWq12bmire=XwaPCtiJs3-80McaZJzyVt3U5dTHge8LxQ@mail.gmail.com' \
    --to=luto@amacapital.net \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=roland@hack.frob.com \
    --cc=serge.hallyn@ubuntu.com \
    --cc=tycho.andersen@canonical.com \
    --cc=wad@chromium.org \
    --cc=xemul@parallels.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 NNTP newsgroup(s).