From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#45198: 28.0.50; Sandbox mode Date: Sun, 18 Apr 2021 11:11:28 +0200 Message-ID: References: <5818DFAA-3A9C-4335-BAAF-1227A02C290A@acm.org> <19511709-E42B-4ABD-9823-39EA08A79B1F@gmail.com> <83v98kvr7y.fsf@gnu.org> <9A5BCDF3-6543-46C0-AB56-2311392FC549@gmail.com> <83tuo4vqet.fsf@gnu.org> <83r1j8vpku.fsf@gnu.org> <83fszovhox.fsf@gnu.org> <8491CEA9-E230-48E4-9AB3-71DF0B4D8A2B@gmail.com> <83czusun95.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13998"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45198@debbugs.gnu.org, Stefan Kangas , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 18 11:12:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lY3TP-0003WO-2U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 11:12:11 +0200 Original-Received: from localhost ([::1]:33662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lY3TN-0006wu-Ns for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 05:12:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lY3TG-0006wo-DK for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 05:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lY3TG-0006NJ-5r for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 05:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lY3TG-0001zm-0w for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 05:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Apr 2021 09:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45198 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45198-submit@debbugs.gnu.org id=B45198.16187371087650 (code B ref 45198); Sun, 18 Apr 2021 09:12:01 +0000 Original-Received: (at 45198) by debbugs.gnu.org; 18 Apr 2021 09:11:48 +0000 Original-Received: from localhost ([127.0.0.1]:45298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lY3T2-0001zK-8H for submit@debbugs.gnu.org; Sun, 18 Apr 2021 05:11:48 -0400 Original-Received: from mail-oi1-f174.google.com ([209.85.167.174]:36558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lY3T0-0001z6-1I for 45198@debbugs.gnu.org; Sun, 18 Apr 2021 05:11:46 -0400 Original-Received: by mail-oi1-f174.google.com with SMTP id v6so4742036oiv.3 for <45198@debbugs.gnu.org>; Sun, 18 Apr 2021 02:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ynZNtmo/+mbeYd6ZY4OnnKdOZkr2/8Ltl47nkRjw7jk=; b=VpipkC/+MFbYFrnn8f6KH9lRrLCAEjN9swrXmRNOmYoFuTIwaacq4jfy2L5Efwjt1V PuBF67gajI7rJMH/QhopQyJyF47RPW+tkr21yXm9D5UwERjJR+6mlvIXjoDrEeoHsxzV 7IvkhqWZAaqF/yHJYJWP2xnCedMwi1hMRPOUEUGVBzY3XHBJd4we8ghSqZFSJJXKJIWX yDvSWdufeRZ8NAIvrsfvTaVOBqPiNkf5nPyeHUdYEqsmait2XhwpqXkhRAAFjXdnzLwt LpgfcWO+esV3/llRJc26RMda3ZPmw/t/OTQWzTVg7K9aGq1GztwYUTYZoFXxycRCJtaS d9Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ynZNtmo/+mbeYd6ZY4OnnKdOZkr2/8Ltl47nkRjw7jk=; b=L/CujC9+BCeFQQZNXiM7/rM0rfNLXcIUwFgr0BLWbQrGFbOIesHEB7VYx2zYJ+LBv2 fdOkZj3XPPaxNVeGTx31nFPoL6e9IJ+yyQQA6WzWPs5IAop0lXr1SaB0Kfu7Y++3UZe7 cgTT7HmcU7AyoVursuAVVZRFg1+B2+AGQiBVXC9GO1h+SqY31pZmPXP7AFk/L/idCeQa eAjy/Zdl196ms69Jx8H8JFsvrNccTOiLdV3pctDe5/6EOGZq1WoKuPaXftnXkOJQNtEk 7bBfZf/IaNXc3jG8rrRXN91ngQ8OvH1N6ZJd1MMeD/fz8yoTOf7kQSUHI9c9l+9iwFxr uWrw== X-Gm-Message-State: AOAM531qoFK8dLVgtWfihhpGNtiougfy9zyibgPotMDOnStLfmSRtKN/ xGjMKBtO3EAYPAKG8Y2RjOmFI/QxT8ax9MCBKDY= X-Google-Smtp-Source: ABdhPJz5x2blbiceWpvrHxkY773iyVVKLk88uxgd+6seLml/ubOyE7Z0PphUYxKq4nMhAQ9uVyC7ilC0QbDLlqMdiLI= X-Received: by 2002:aca:1814:: with SMTP id h20mr12139915oih.150.1618737100372; Sun, 18 Apr 2021 02:11:40 -0700 (PDT) In-Reply-To: <83czusun95.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204314 Archived-At: Am So., 18. Apr. 2021 um 08:21 Uhr schrieb Eli Zaretskii : > > > From: Philipp > > Date: Sat, 17 Apr 2021 21:52:59 +0200 > > Cc: Mattias Engdeg=C3=A5rd , > > Jo=C3=A3o T=C3=A1vora , > > 45198@debbugs.gnu.org, > > stefankangas@gmail.com, > > monnier@iro.umontreal.ca, > > alan@idiocy.org > > > > > So you are going to suggest that we rely on some auditing of the > > > syscalls Emacs uses now to decide which ones to filter and which not? > > > > I don't mean that we should wade through all potential syscalls that Em= acs could make. Typically you can come up with such a Seccomp policy itera= tively: run Seccomp in advisory mode (i.e. only log syscalls), then allow t= he syscalls that are both necessary and harmless in the policy. > > Emacs can be invoked to do many different things, and will > correspondingly present very different profiles of syscalls. Is the > procedure you envision practical, let alone seamless, given that it > will have to become part of the maintenance and the release process? Yes. There aren't that many syscalls to begin with, and Emacs uses only a small subset of them. New Emacs or libc versions occasionally introduce new syscalls, but finding and allowing them tends to be not that big of a deal. > > > And what about users who make local changes > > > in their Emacs? > > > > They can provide their own Seccomp policies or modify the ones included= in Emacs. > > What does providing a policy entail? can you describe the procedure of > tailoring a policy to changes in the Emacs code? 1. Run the Emacs sandbox with the code you want to run. 2. Emacs will crash with SIGSYS if it hits a forbidden/unknown syscall. Ensure that this generates a coredump. 3. Check the backtrace for the coredump (e.g. coredumpctl debug) and/or the Seccomp audit logs (ausearch) for the syscall that triggered the signal. 4. Add a rule for the syscall and its arguments to the BPF generation program, e.g. lib-src/seccom-filter.c. 5. Regenerate the BPF rule file.