Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp2220539ybm; Sun, 31 May 2020 12:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3FKv5SXYoLuw2cwSGKCq0Ewaw1IGjwD/te4jccv0n1Z1g0L7lkR3SeRM4ShN6v/v+PM5I X-Received: by 2002:a50:d556:: with SMTP id f22mr18993055edj.307.1590954001364; Sun, 31 May 2020 12:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590954001; cv=none; d=google.com; s=arc-20160816; b=F1iSzf++AYiiwH7eoW5EcTKx3oS22XSHJiPGjajvETCCrhPxTDVxfAn0QxYGQkMYgp nod12sUtwHUdx/dvsxwFYUdbJeAoM9b+kJq9Pn+FfQBEt/+5E5scrzjFgUgObow5IjhL 8cgcRHSOnCUQjwKi2AO/Lou6f7pqWyZQNEWXLBEOg10ikwBsw9dnP6+ZO+kX/Sv44xhb BHdUPuRhIED7KoLZGGyMCO6dO0e/7Y5e1UAhbT9gXA2cv/+ZWbHLUZhz5k83gUXHIXvn iUI5hgIKVrRO7Gg454Fp0zsieK5Bd7kaBSrL1Dieu22uVl4xXfEfY2oPCP65scsNHUDA R/TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=3xp/CX4ZXzyXsreYB+Mkkdy0o2I1FNvVPwlUiEbvMCk=; b=xVE3QQEDO6j4VhF2T377qJNHKOovwvmY4pT+aVvFvyrvHBjdJLnO46R3jmwD5gEeKk b6gBCW+DajYTe6M9JJmzhuQTDKFyZEyq4toogk6fiwlAGgurYPY3QT6WmDUFMKjAxaWr krrbKp7FaZnJEF+4WnpyIcIxnTA0Uso8RKKiyVLMp46AbL+bsgYMYVocMXHjYqIIeUCD 7nsV93b+f1gwXTXKEt+bP4l1OkGob6qYSRX9CIENnvl7SHVV30anhGeqxYt8wmrlYew+ AErDy6gmGUzDxMXv0YyIbtSeviQxXaYiq731hUzeoW/89hWgLmvVXXyErDPCUYXnY/ff JpBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VeJE+sRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si7318122edz.261.2020.05.31.12.39.36; Sun, 31 May 2020 12:40:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VeJE+sRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgEaThf (ORCPT + 99 others); Sun, 31 May 2020 15:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbgEaThf (ORCPT ); Sun, 31 May 2020 15:37:35 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B48C061A0E for ; Sun, 31 May 2020 12:37:34 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id y1so6125282qtv.12 for ; Sun, 31 May 2020 12:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=3xp/CX4ZXzyXsreYB+Mkkdy0o2I1FNvVPwlUiEbvMCk=; b=VeJE+sRNuq7WuF1Wpz7fnSmopdwXjKw+9J9t/FQhLIAilYRJf+pMFBQQLyMzNg6hH1 c3fvWUvCVpHFZIw4Tc6Z7+uUWTymK4TH/+lcAqFeJYrnzC9pp3D9czoK5HurbkazwFTQ kWOyWq5IxDC6mkKUwjXZYSp3dE+BS66nQo/WXkjUZT347NAlmes7f1FcWEU0pyMlvT6/ 7RicZDX+WplnYOsdXuWiXCBEFsB64zNzHscgslxzy6mRDmQVfljBVIU9Rdswd7nA6aKi vKTojLvq1ZjDSsiPmZQklTkFhiJjzgyOsFsXlYe87ShxACrrRFDYclU9RQrAHd2DqJqx qzlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=3xp/CX4ZXzyXsreYB+Mkkdy0o2I1FNvVPwlUiEbvMCk=; b=Oc9aS/sGbXeGedkHxMgaIgwQG80dNFFNBsf9P30QO+z5jTUL0JzA3XABTpp9s26YtZ XWNuYZg7O+Y3zZyAZinDW9hJJm1r0yC9qXv7YWF2XDU6mYgpn7fHRmNwuKmYVgNtLZt0 VXG9FVOTgU/UDQ2m7bXwJpy9LeLxwgFapJ/n6ZEKts9JESq8EoSBbQpzZnpIjbgDjtDo twLmtmcJ/dsJlQeMyYiJ179ljS/yCIgSrJYErWk5GQyg7frXx9+Wk1drLkckk7zo17xg b9Ot1nUTilWVm60fI5lYvk89DjXvA1isNtttrGoWaTDQSA+It2UiOcoXepYdegW93U0B 1y6w== X-Gm-Message-State: AOAM532wiuF8Z6hpu2NHIcQ1KFuQV6g5HegNJriJZ9gD+B7yHl/nqGQe NpeDui1lIMmT+Q7vgoOCRR8= X-Received: by 2002:ac8:4e8c:: with SMTP id 12mr18667331qtp.20.1590953853494; Sun, 31 May 2020 12:37:33 -0700 (PDT) Received: from [192.168.1.62] (89-178-168-199.broadband.corbina.ru. [89.178.168.199]) by smtp.gmail.com with ESMTPSA id l69sm5268280qke.112.2020.05.31.12.37.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 May 2020 12:37:32 -0700 (PDT) Subject: Re: [PATCH RFC] seccomp: Implement syscall isolation based on memory areas To: Andy Lutomirski Cc: Gabriel Krisman Bertazi , Linux-MM , LKML , kernel@collabora.com, Thomas Gleixner , Kees Cook , Will Drewry , "H . Peter Anvin" , Zebediah Figura , Matthew Wilcox References: <85367hkl06.fsf@collabora.com> <079539BF-F301-47BA-AEAD-AED23275FEA1@amacapital.net> <50a9e680-6be1-ff50-5c82-1bf54c7484a9@gmail.com> From: Paul Gofman Autocrypt: addr=gofmanp@gmail.com; prefer-encrypt=mutual; keydata= mQINBF0Dv54BEAC1ATtFV/oNVw7bEH41UKUhzGR3FkorCsQuLZmSV8/ztVoukgl16O9FTd+Z T3nMiT5hEo4EfO7IcmXPputpKnxBAcAxW78i3kd6dgYs56/F56R5g+0RGqojuA+nx1ij+Cg3 erbaq6Zrg3jMjiSIiT1O9fHEj1xT5QCX3IhEyMX+Gg5HAM/fw5O059S7i9Dmz9d/7FgkLsr8 PS/pA+dQcC3R59/Be8MqjtnnfTlp+X7JFrcfJ50bGdMf4Cs3L3OsaUtydO/Znp3snPPBJktE fti9DCPcJskwN14S9yyRVj75pib2thLHmcWOTbFw+MOHzhk1K47QOSQgoHPd7QvegmDiUOJa 8gCCCLnNY+oIRP93a1lIm7YOab3TeImU5DcJ6S/+kyXw9qlJxhrzKdERJDGkEXP/3/tsnD8q 5sEO8GM9AppAxzkthZV98gKPOs+AAQBPN9Mmxa2/o7zv6WAvkGpkIH/FT3mTmRy0O28KvFbS hPT+gttvWK/qbp7oWT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zNDLiTC1cfnaSIDeMsPyU16Nv5v849Tkh1GvikyfDk49QVqjph/tQ8lKg1Imu ciR6z5o1avxdf4+E7IkJyDItxCxo0rNrZoLb9qvwgRcI4XP0Y4pw01iHXRff8/RDVTCmxUau Qhr4fPQqB3v+P2iWtyEPiT2jiUiASeHprY0PJzz/X4uIcJM4286D6f2Lxt4XPZBfM4h6082p lhxeUnfUGYARdiQF6hVUmmXaXkCZPoakovWwbGmL2l7bbAPdcwlrsqM95wqJ72WFxxYP96OO 2YVmrcr1e5NKsu7izqjiu+JS70BAHhy2BOyqI4f89DzW0u3jfMNC9jqliWwo7zRCPA== Message-ID: <38da7b26-8ff4-419a-c848-5eebf4969647@gmail.com> Date: Sun, 31 May 2020 22:37:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/31/20 21:57, Andy Lutomirski wrote: > > I think that the implementation may well want to live in seccomp, but > doing this as a seccomp filter isn't quite right. It's not a security > thing -- it's an emulation thing. Seccomp is all about making > inescapable sandboxes, but that's not what you're doing at all, and > the fact that seccomp filters are preserved across execve() sounds > like it'll be annoying for you. Yes, sure, preserving those filters (more broadly, lack the ability to change them any time in an arbitrary way) is the major problem preventing us from using seccomp filters as is for a generic solution. If not that, growing the table too much (which might be the case if we mark all the denied address ranges there) may potentially be a performance problem, but not necessarily, that's something to be tested. > > What if there was a special filter type that ran a BPF program on each > syscall, and the program was allowed to access user memory to make its > decisions, e.g. to look at some list of memory addresses. But this > would explicitly *not* be a security feature -- execve() would remove > the filter, and the filter's outcome would be one of redirecting > execution or allowing the syscall. If the "allow" outcome occurs, > then regular seccomp filters run. Obviously the exact semantics here > would need some care. Yes, absolutely, we are not implementing any sandboxing in Wine and are not seeing this as a security feature. Is the approach discussed in another branch of this thread [1] is some way similar to what you suggest? If instead of the list of memory addresses we can use some single flag which we can set by thread when crossing Windows program / native boundary, we won't have to grow the lookup table indefinitely. Otherwise I am afraid the list of addresses might be growing big, but I don't have reasons to think it necessarily won't work, that's something we could evaluate further and also test performance given some brief proof of concept implementation. 1. https://lkml.org/lkml/2020/5/31/199