From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8C24C433E1 for ; Sun, 31 May 2020 18:10:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EE0B206B6 for ; Sun, 31 May 2020 18:10:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="TOGypFka" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EE0B206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A12480007; Sun, 31 May 2020 14:10:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 251A18E0003; Sun, 31 May 2020 14:10:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18E3680007; Sun, 31 May 2020 14:10:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id F1ED18E0003 for ; Sun, 31 May 2020 14:10:22 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A8645181AEF09 for ; Sun, 31 May 2020 18:10:22 +0000 (UTC) X-FDA: 76877803884.11.rice23_5a8d1c84f4e27 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 8C2E0180F8B81 for ; Sun, 31 May 2020 18:10:22 +0000 (UTC) X-HE-Tag: rice23_5a8d1c84f4e27 X-Filterd-Recvd-Size: 3927 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sun, 31 May 2020 18:10:22 +0000 (UTC) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED84F207D5 for ; Sun, 31 May 2020 18:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590948621; bh=coKg1dFR2wviMowGB6sRKtlm96WsZo+FklYL+j+PeIU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TOGypFkaW4/TfPCmS5SCQN1GbSYnBKnbrtk9tQSbQxFXTueNA6ujFwr6IgLLlSdHd nRVOcsoGEoI1eCI+Ekj2x6FKelUwoTvohXc3NHx4FWn7gKGoNoy9COLNEbHWTzjgxF +EIHYGwov2gPdAta3vlWRq6LlNh06j/EAR5uZAqU= Received: by mail-wm1-f49.google.com with SMTP id d128so9211215wmc.1 for ; Sun, 31 May 2020 11:10:20 -0700 (PDT) X-Gm-Message-State: AOAM533zbTuY4N3csz0rWuk/iy2wnwK3NVGpUkyncAU22KxbvSWvVTUa 0OEuZc6qBwoZs1DoR9m/vvp/g3KYoqb2JmWaHmt4xg== X-Google-Smtp-Source: ABdhPJwfCL2ZvJtCsgkpFp5o3LMlfxxpc3pgXA1R6bHM7bTcP3sPGZVd2dsjD7jHA2iB11A5WGh7kPwW5LvJlm/uH04= X-Received: by 2002:a1c:46c3:: with SMTP id t186mr17292708wma.36.1590948619546; Sun, 31 May 2020 11:10:19 -0700 (PDT) MIME-Version: 1.0 References: <85367hkl06.fsf@collabora.com> <079539BF-F301-47BA-AEAD-AED23275FEA1@amacapital.net> <50a9e680-6be1-ff50-5c82-1bf54c7484a9@gmail.com> In-Reply-To: <50a9e680-6be1-ff50-5c82-1bf54c7484a9@gmail.com> From: Andy Lutomirski Date: Sun, 31 May 2020 11:10:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC] seccomp: Implement syscall isolation based on memory areas To: Paul Gofman Cc: Gabriel Krisman Bertazi , Linux-MM , LKML , kernel@collabora.com, Thomas Gleixner , Kees Cook , Will Drewry , "H . Peter Anvin" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8C2E0180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, May 31, 2020 at 5:56 AM Paul Gofman wrote: > > On 5/31/20 03:59, Andy Lutomirski wrote: > > > > I=E2=80=99m suggesting that the kernel learn how to help you, maybe lik= e this: > > > > prctl(PR_SET_SYSCALL_THUNK, target, address_of_unredirected_syscall, 0,= 0, 0, 0); > > > > This would be inherited on clone/fork and cleared on execve. > > > If we are talking about explicit specification of syscall addresses to > be trapped by Wine, the problem here is that we don't have any way of > knowing the exact addresses of syscalls to be redirected. We would need > some way to find those syscalls in the highly obfuscated dynamically > generated code, the whole purpose of which is to prevent disassembling, > debugging and finding things like that in it. What we do know is that if > a syscall is executed from any memory which Wine allocates for Windows > application then it should be treated as Windows syscall and routed to > the Wine's dispatch function. Those code areas can be dynamically > allocated and deallocated. That's not what I meant. I meant that you would set the kernel up to redirect *all* syscalls from the thread with the sole exception of one syscall instruction in the thunk. This would catch Windows syscalls and Linux syscalls. The thunk would determine whether the original syscall was Linux or Windows and handle it accordingly. This may interact poorly with the DRM scheme. The redzone might need to be respected, or stack switching might be needed.