linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@virtuozzo.com>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <james.l.morris@oracle.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Paul Moore <paul@paul-moore.com>,
	Tyler Hicks <tyhicks@canonical.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] seccomp: Only dump core when single-threaded
Date: Mon, 13 Feb 2017 22:37:26 -0800	[thread overview]
Message-ID: <20170214063724.GA9021@outlook.office365.com> (raw)
In-Reply-To: <20170207231851.GA129818@beast>

On Tue, Feb 07, 2017 at 03:18:51PM -0800, Kees Cook wrote:
> The SECCOMP_RET_KILL filter return code has always killed the current
> thread, not the entire process. Changing this as a side-effect of dumping
> core isn't a safe thing to do (a few test suites have already flagged this
> behavioral change). Instead, restore the RET_KILL semantics, but still
> dump core when a RET_KILL delivers SIGSYS to a single-threaded process.
> 
> Fixes: b25e67161c29 ("seccomp: dump core when using SECCOMP_RET_KILL")
> Signed-off-by: Kees Cook <keescook@chromium.org>

All CRIU tests passed with this patch. Thanks!

Acked-by: Andrei Vagin <avagin@virtuozzo.com>

> ---
>  kernel/seccomp.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index f8f88ebcb3ba..e15185c28de5 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -643,11 +643,14 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
>  	default: {
>  		siginfo_t info;
>  		audit_seccomp(this_syscall, SIGSYS, action);
> -		/* Show the original registers in the dump. */
> -		syscall_rollback(current, task_pt_regs(current));
> -		/* Trigger a manual coredump since do_exit skips it. */
> -		seccomp_init_siginfo(&info, this_syscall, data);
> -		do_coredump(&info);
> +		/* Dump core only if this is the last remaining thread. */
> +		if (get_nr_threads(current) == 1) {
> +			/* Show the original registers in the dump. */
> +			syscall_rollback(current, task_pt_regs(current));
> +			/* Trigger a manual coredump since do_exit skips it. */
> +			seccomp_init_siginfo(&info, this_syscall, data);
> +			do_coredump(&info);
> +		}
>  		do_exit(SIGSYS);
>  	}
>  	}
> -- 
> 2.7.4
> 
> 
> -- 
> Kees Cook
> Pixel Security

  reply	other threads:[~2017-02-14  6:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 23:18 [PATCH] seccomp: Only dump core when single-threaded Kees Cook
2017-02-14  6:37 ` Andrei Vagin [this message]
2017-02-14 19:09   ` Kees Cook
2017-02-14 22:34     ` James Morris
2017-02-22 23:35       ` Andrei Vagin
2017-02-23  0:01         ` Kees Cook

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=20170214063724.GA9021@outlook.office365.com \
    --to=avagin@virtuozzo.com \
    --cc=james.l.morris@oracle.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=paul@paul-moore.com \
    --cc=tyhicks@canonical.com \
    --cc=vapier@gentoo.org \
    --cc=wad@chromium.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;
as well as URLs for NNTP newsgroup(s).