From: Riku Voipio <riku.voipio@iki.fi>
To: James Cowgill <james.cowgill@mips.com>
Cc: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: return EINVAL from prctl(PR_*_SECCOMP)
Date: Mon, 6 Nov 2017 20:06:18 +0000 [thread overview]
Message-ID: <20171106200618.GD19281@kos.to> (raw)
In-Reply-To: <20171106180351.30749-1-james.cowgill@mips.com>
On Mon, Nov 06, 2017 at 06:03:51PM +0000, James Cowgill wrote:
> If an application tries to install a seccomp filter using
> prctl(PR_SET_SECCOMP), the filter is likely for the target instead of the host
> architecture. This will probably cause qemu to be immediately killed when it
> executes another syscall.
>
> Prevent this from happening by returning EINVAL from both seccomp prctl
> calls. This is the error returned by the kernel when seccomp support is
> disabled.
Thanks, applied to linux-user
> Fixes: https://bugs.launchpad.net/qemu/+bug/1726394
> Signed-off-by: James Cowgill <james.cowgill@mips.com>
> ---
> Changes from v1:
> - add comment
>
> linux-user/syscall.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index d4497dec5d..419991e834 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -10482,6 +10482,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> break;
> }
> #endif
> + case PR_GET_SECCOMP:
> + case PR_SET_SECCOMP:
> + /* Disable seccomp to prevent the target disabling syscalls we
> + * need. */
> + ret = -TARGET_EINVAL;
> + break;
> default:
> /* Most prctl options have no pointer arguments */
> ret = get_errno(prctl(arg1, arg2, arg3, arg4, arg5));
> --
> 2.15.0
>
>
prev parent reply other threads:[~2017-11-06 20:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 12:07 [Qemu-devel] [PATCH] linux-user: return EINVAL from prctl(PR_*_SECCOMP) James Cowgill
2017-11-03 14:29 ` Laurent Vivier
2017-11-03 15:52 ` James Cowgill
2017-11-03 16:01 ` Peter Maydell
2017-11-03 16:33 ` Laurent Vivier
2017-11-03 14:30 ` Peter Maydell
2017-11-06 18:03 ` [Qemu-devel] [PATCH v2] " James Cowgill
2017-11-06 19:41 ` Laurent Vivier
2017-11-06 20:06 ` Riku Voipio [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=20171106200618.GD19281@kos.to \
--to=riku.voipio@iki.fi \
--cc=james.cowgill@mips.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.