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: Sat, 10 Apr 2021 19:44:45 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25642"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Bastien , 45198@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 10 19:46:16 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 1lVHgV-0006Zb-K6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 19:46:15 +0200 Original-Received: from localhost ([::1]:60680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVHgU-0000Lk-M5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 13:46:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVHgI-0000HF-1d for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 13:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVHgH-0003NO-Lu for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 13:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVHgH-0006a1-JE for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 13:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Apr 2021 17:46: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.161807670425221 (code B ref 45198); Sat, 10 Apr 2021 17:46:01 +0000 Original-Received: (at 45198) by debbugs.gnu.org; 10 Apr 2021 17:45:04 +0000 Original-Received: from localhost ([127.0.0.1]:53204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVHfL-0006Yi-Vk for submit@debbugs.gnu.org; Sat, 10 Apr 2021 13:45:04 -0400 Original-Received: from mail-oi1-f171.google.com ([209.85.167.171]:43734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVHfK-0006Xy-Rv for 45198@debbugs.gnu.org; Sat, 10 Apr 2021 13:45:03 -0400 Original-Received: by mail-oi1-f171.google.com with SMTP id n8so9193401oie.10 for <45198@debbugs.gnu.org>; Sat, 10 Apr 2021 10:45:02 -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; bh=gwxecy6Vc1oV3tC5nx3nBkQyxqUlHkbFxif2f4PlapE=; b=i0S0rH08oyPX76sH5jm2o9IeZTI+fWUoOzYIm9WnXsN9IywlPu1gaLpHP4YZK9X5B8 pQwrF6DdyDvSqdw1v1zUnR8reiWgsMuW1mlPjzjBt6CfReS6np3AL/xvlme66sKWYlSL Kga3yPWwNvSjaHb3xc1by1VQ6oryDVhxkTgoUje6nJfkU+WHI/1iJ+Gz58aO2di2KmOj ZKVJIdpue5O+rqpvnIdgdou8pNdmvcBJOYMyAILCNPBUzp83aIPL/3fPqGC0k9lPaKCB fTzicVFopMxpSUBSB25wZ17qA431btpr/+B7A0Td380alKG8YzmQGSbsbS5fghm40Lps x4mg== 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; bh=gwxecy6Vc1oV3tC5nx3nBkQyxqUlHkbFxif2f4PlapE=; b=S+elxG/qh/6rlBsG+zO+Q3ezbm5fhy2KxFofcb22AHBTwiOtU126JBv30bdI25eda5 nWCNJxYAthwEENPVvZ2pAIV6bc6dY7hpaJWOGTcyEzB/uG8I0VRWs2EwDMfzWqejBntH wZpXwyOKW+oZWpa/kG3G7QOwhulxDM33pokDzXb8irPoUSR0Wt0vsJSkkWEsOD+kJP9h JQHuTdhtxFka1JrkCRNcDVUcQu4n8Tz0pn+dj0CB0p8tuzS6zwkuvLPxNSNOQ/2Inflk IatTZZqmYE9e4mIiNCOBgC2jqcf7TmuSBh6zDKgvjPIJhc9TyVW/WHqgY7mV6BODC15U uf5A== X-Gm-Message-State: AOAM533p3hb+9ABOo4PfOYcQ2L9FKS+7SP9xMVy0+tn0DLIy44ZsKYYi AFYXirVOGB0WyIK0K2IbtbLYN1vwAVcDp7zgjZQ= X-Google-Smtp-Source: ABdhPJzPH7i3d6HBYblyZaAh86E8cs2GaqjXpUlGzpJMPy8HQZaTUx6/KVh3DuZVvmZ0JgCBF1rPBDqsQVq0ECP4JlQ= X-Received: by 2002:aca:6543:: with SMTP id j3mr14327382oiw.158.1618076697017; Sat, 10 Apr 2021 10:44:57 -0700 (PDT) In-Reply-To: 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:203811 Archived-At: Am Sa., 19. Dez. 2020 um 19:18 Uhr schrieb Philipp Stephani : > > Am Mo., 14. Dez. 2020 um 12:05 Uhr schrieb Philipp Stephani > : > > > > > >> - This will need someone else doing the implementation. > > > > Looks like we already have a volunteer for macOS. > > > > For Linux, this shouldn't be that difficult either. The sandbox needs > > > > to install a mount namespace that only allows read access to Emacs's > > > > installation directory plus any input file and write access to known > > > > output files, and enable syscall filters that forbid everything except > > > > a list of known-safe syscalls (especially exec). I can take a stab at > > > > that, but I can't promise anything ;-) > > > > > > Looking forward to it. > > > > > > > I've looked into this, and what I'd suggest for now is: > > 1. Add a --seccomp=FILE command-line option that loads seccomp filters > > from FILE and applies them directly after startup (first thing in > > main). Why do this in Emacs? Because that's the easiest way to prevent > > execve. When installing a seccomp filter in a separate process, execve > > needs to be allowed because otherwise there'd be no way to execute the > > Emacs binary. While there are workarounds (ptrace, LD_PRELOAD), it's > > easiest to install the seccomp filter directly in the Emacs process. > > I've attached a patch for this. I've verified that a slight variant of this patch doesn't break either the Windows or macOS builds, and pushed it to master as commit be8328acf9aa464f848e682e63e417a18529af9e.