From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#45198: 28.0.50; Sandbox mode Date: Sun, 13 Dec 2020 11:14:53 +0000 Message-ID: <87zh2iyn2q.fsf@gmail.com> References: <83mtyierfs.fsf@gnu.org> <83ft4ae63m.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="25002"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: bzg@gnu.org, 45198@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 13 12:16:12 2020 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 1koPMK-0006PZ-1A for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 12:16:12 +0100 Original-Received: from localhost ([::1]:41046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koPMI-0006xq-6t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 06:16:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koPMA-0006xh-98 for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 06:16:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1koPMA-00005g-26 for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 06:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1koPM9-0002aN-SQ for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 06:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Dec 2020 11:16: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.16078581049680 (code B ref 45198); Sun, 13 Dec 2020 11:16:01 +0000 Original-Received: (at 45198) by debbugs.gnu.org; 13 Dec 2020 11:15:04 +0000 Original-Received: from localhost ([127.0.0.1]:47508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koPLD-0002W0-To for submit@debbugs.gnu.org; Sun, 13 Dec 2020 06:15:04 -0500 Original-Received: from mail-wm1-f47.google.com ([209.85.128.47]:34981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koPLC-0002Ul-Bd for 45198@debbugs.gnu.org; Sun, 13 Dec 2020 06:15:02 -0500 Original-Received: by mail-wm1-f47.google.com with SMTP id e25so12636863wme.0 for <45198@debbugs.gnu.org>; Sun, 13 Dec 2020 03:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=0dFJ7REgDbDr/rzkxNYFIArDFiDosKqonAV8Sm2wWcE=; b=Gxm1CSkGayAmr6FPduOVE87OrVap+e7lIhjeNUeNxVI0Zm5NCMVPWTwZG+2f9PgJ1t opaU3850kaCdVjnI2ezrahAoO+wWmx3W4NIaneQ0lGEeiIihvU+6BKXLLyXzrwTxOFmO 0FplnYCJiYe7XYCdmUGKL2fGPD6Mj3t2FOKj6w8xB1viE0oaThOEREv+CLzuw3zG0uOW 26KPuEbpdep93Grjwt+0n3l3mrSxDMKJvToCi3vouKveJvVvANbOG+7eV818a0128OAl xTKNf7CeS/STX7hNCZ8MJqebOG+KGKFruY5PDbza4SCQwc5muU/mzlvuX1jZj1ft2hY5 GjFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=0dFJ7REgDbDr/rzkxNYFIArDFiDosKqonAV8Sm2wWcE=; b=ARvSTyB0fwGx469lcEwrcWGA75qmBEZEjwJ3yaNAyw051Qvr9csnT4s1fmo9bVW9aK LmBOTwr66enX4eU6/7XJb8bZo6k5jY+A+0yeab+RdDIbGyjvhl+SD3UvVg/YlrKTIKg2 ZLvbMPE7UoLQkkcy7BJ1mZStiSa+JhvbUm782gbyVy/uPC/QXG+LsXPEtbFammx6Xwmp Bp7DEoYMx+m3XCd7f9Tkc5Ahuk2XSYkagXS6AkUf22wBFI9g9+ZTsF4aWEZAmKvXe4ys LuzmQa4F7UFBlkznKfzAiuHdgMM3L/ZrPBKyMqkQN07INjS55UmgnvctHfF/PMgAsUWj UD/g== X-Gm-Message-State: AOAM533HMZgzfBzQXKuIMYNIW3gRuJegOgovhqCFKmTUwZT6s3t5qaXF 0I7RR8Ihga3knD4c0qy/4sTSVl5+H0s= X-Google-Smtp-Source: ABdhPJyhUC7J9Fp0YYQc+dDzSJ4b3PLmfbnFTSdI+hNLdtMBvbSBactvqydlmpIm8UbH/PDyAG+dOA== X-Received: by 2002:a1c:c287:: with SMTP id s129mr1598307wmf.79.1607858096559; Sun, 13 Dec 2020 03:14:56 -0800 (PST) Original-Received: from krug ([89.180.146.231]) by smtp.gmail.com with ESMTPSA id h15sm24521929wru.4.2020.12.13.03.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Dec 2020 03:14:55 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sat, 12 Dec 2020 23:25:27 -0500") 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:195943 Archived-At: Stefan Monnier writes: >>> > You cannot usefully call error from redisplay. >>> Hmm... but this is at the entrance to redisplay, so I though it should >>> still be safe at that point. If it's a problem we can replace the above >>> with >>> if (emacs_is_sandboxed) >>> return; >> Yes, I think this is what we should do in this case. > > With the change I just installed into `master`, I can now get > `elisp-flymake-byte-compile` to use sandboxing successfully with the > revised patch below. Fantastic! > Besides the above change, I made the same change in `Fdo_auto_save` > (i.e. `do-auto-save` was made to just silently do nothing instead of > signaling an error since it seemed to be too much trouble to change its > callers to avoid calling it when sandboxed). > > I'm still worried that there remain wide open security holes, tho. First, I wouldn't worry that terribly. This is certainly and improvement. I won't be bitten again like that time I accidentally typed (delete-directory ".") at macroexpand time. That said, as you said the whitelisting approach is the safest one. It'd be nice if you we a way to identify system calls and block all by default. Then whitelist a bunch of calls (checking arguments). Not sure if this can be done portably/systematically, though. Chroot also comes to mind, but it's only for linux, right? Jo=C3=A3o