From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OHxVKBvHAmKefwAAgWs5BA (envelope-from ) for ; Tue, 08 Feb 2022 20:40:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IdcPJRvHAmIRCAEAauVa8A (envelope-from ) for ; Tue, 08 Feb 2022 20:40:11 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E83052B8E5 for ; Tue, 8 Feb 2022 20:40:10 +0100 (CET) Received: from localhost ([::1]:43436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHWLR-0005Ar-N6 for larch@yhetil.org; Tue, 08 Feb 2022 14:40:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHWEa-0008Ro-EA for guix-patches@gnu.org; Tue, 08 Feb 2022 14:33:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHWEY-0000FN-GF for guix-patches@gnu.org; Tue, 08 Feb 2022 14:33:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHWEY-0007U9-E9 for guix-patches@gnu.org; Tue, 08 Feb 2022 14:33:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53676] [PATCH 0/5] *** PulseAudio service improvements *** Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 08 Feb 2022 19:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53676 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Jack Hill , 53676@debbugs.gnu.org Received: via spool by 53676-submit@debbugs.gnu.org id=B53676.164434872228694 (code B ref 53676); Tue, 08 Feb 2022 19:33:02 +0000 Received: (at 53676) by debbugs.gnu.org; 8 Feb 2022 19:32:02 +0000 Received: from localhost ([127.0.0.1]:48708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHWDa-0007Sf-EN for submit@debbugs.gnu.org; Tue, 08 Feb 2022 14:32:02 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:39599) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHWDY-0007SF-5Y for 53676@debbugs.gnu.org; Tue, 08 Feb 2022 14:32:01 -0500 Received: by mail-ed1-f67.google.com with SMTP id u18so503880edt.6 for <53676@debbugs.gnu.org>; Tue, 08 Feb 2022 11:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=ssIRlFAFWJUIB5+LBFzHwGjgFRwdXgeORLF4t/sOFG0=; b=B1lPwUTEf4b5SAWMrz+7oZGSxPmNnH0AHFtub0Rr8KsKf9191kFO3niKyCcVvHagnF HmHWig0QekVfHnK6CFqckre/2Syi95ixymO71rbO5SXcJUOrg9hl5BNMdLco80sTsN4C pfzCIrXkae2EIY3/1sWFzJ94BuoFVR0muXb3iKzoiuEBbMrIK69T1f5414tjuxIGoZbW CqHc4SvrLuPYu7PhQyhA1YeRCvH0rLkDKSlNBzSGvkaO+Sk03Yt4yOp4a+Ttmoj8y60B yJ/W03EYeVtyVDpKoZTUIMPMftWxTNB7HglxQCsN94UeosboNVJ/FYLor2OerejZB2Ra 42Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=ssIRlFAFWJUIB5+LBFzHwGjgFRwdXgeORLF4t/sOFG0=; b=CGEpfGicwMrAFSTWx+LRFE0w4A5q0QUH4/KdDQT+cGakeEVB1POD53Ecy3lUMqsHQ9 D3JSnCZzWl+YdGvN+JZa0QbLGAk5U9Z2C0S01UCIezXp7oFbjysqLbJX0d1X0w9M1JxZ m5lOk8LIsYWzNRJvw8GGrSWLZ1lTKs55ue0YeoGywnH8hvy4hzaiKPo2c0XyukFY2pR2 m9IJqWG4OuBeWfqmRqQqDPK6HS28SyOv0ITMaVe4UwTLjDSc6lh7UYZZX8RLT8IHmzHC F2/XXsIiP4NIkndtnNqVCGYIk8HPCTxqdCN0KaqGARP8MGKy3mp9eDKqo3mR7+RDZ0MR NLTA== X-Gm-Message-State: AOAM533kmSS6zzXVFl1feDaGTsWvdNiY7WKBXaG7Rx3P41JhSaOuze2C T2TaOV29AC5BlKsKy7PXspM= X-Google-Smtp-Source: ABdhPJw3KCx3FzW+XZYtKYoG5Wuib0rn+m+hbh0HVyDxEmTKJDPe3HciB0Or1S0lY2eVBTkNxJlK8g== X-Received: by 2002:aa7:c689:: with SMTP id n9mr6085672edq.412.1644348714009; Tue, 08 Feb 2022 11:31:54 -0800 (PST) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id cr8sm7326217edb.47.2022.02.08.11.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 11:31:53 -0800 (PST) Message-ID: From: Liliana Marie Prikler Date: Tue, 08 Feb 2022 20:31:52 +0100 In-Reply-To: <87zgn11lll.fsf@gmail.com> References: <20220201041933.16603-1-maxim.cournoyer@gmail.com> <20220201041933.16603-5-maxim.cournoyer@gmail.com> <87mtj2z4xe.fsf_-_@gmail.com> <87zgn11lll.fsf@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644349211; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ssIRlFAFWJUIB5+LBFzHwGjgFRwdXgeORLF4t/sOFG0=; b=exZz7Qcuakkb4jK2Q96GbB8FOwxXpqXMGBnNiYiRaxA+cUHPrXxiYK+sCspDAzW9uNHHVm AsjUva4pRKHv2SGWBwT4xAI2bwcK7CJjDg+GXgsuJPeSi78v1Ku0galPhpT9cm9vEeAvy6 EWXNFiDBRSTz7BZXAWpj7KTtyMxWcGNsJAltU+f5WS2Y1IVbXjyVcL37sbMvUtM4KJqHZo UoOgQ8gmp6dD/0eEPyskIQkRRrIF+mbS+5WZYyVpGZedBFJdIpzgvaQ+1Ih17fWxqEGsau hNhkrFlIKWNfgCDD7cSXL7ErureN3acSK78BCd6Z21UuQfVigrVMHLpakgPsgg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644349211; a=rsa-sha256; cv=none; b=oPblyDQNzhM5P00pXUZia0jfp+01/OEk19f9SW16uhj1AHL0zWSg5yycAWyolCOWXqX9Bc G+2FJoJJn3ZRzPw1eymMXX1hFXKWLVYbkVBpvypv/uG9ILrZ43/YH8UK/096sYt+ZKMbcr XQ+ERNiHL7o6i/hbguq5oSSz1M/E7zCijjjojR51qaaXb4e3uZyJJCkLuvhr+cm3NmvtpN mKfOKkm+5g2GPp5KBsjW4cOV4HIDZlQPA3bSlos9OnnX/JbB3p06/4pt8AQIsueHT3BJ32 sQ/sP0GWqmC45hN9H8JcGbUe2qBB/4J7dHeGWtL4nsFs+8G+9ZFT2fXJT/WdTA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=B1lPwUTE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.53 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=B1lPwUTE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E83052B8E5 X-Spam-Score: -3.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3nr6jlvW2vhe Hi, Am Dienstag, dem 08.02.2022 um 09:25 -0500 schrieb Maxim Cournoyer: > Hi Liliana, > > Liliana Marie Prikler writes: > > > Hi, > > > > Am Montag, dem 07.02.2022 um 17:29 -0500 schrieb Maxim Cournoyer: > > > Thanks for this!  I wasn't aware of the history; I tried it and > > > it > > > failed the same.  The following fix I attempted in webkitgtk did > > > not > > > seem to do anything: > > > > > > --8<---------------cut here---------------start------------->8--- > > > modified   > > > Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp > > > @@ -24,6 +24,7 @@ > > >  #include > > >  #include > > >  #include > > > +#include > > >  #include > > >  #include > > >  #include > > > @@ -337,7 +338,16 @@ static void bindIfExists(Vector& > > > args, > > > const char* path, BindFlags bind > > >          bindType = "--ro-bind-try"; > > >      else > > >          bindType = "--bind-try"; > > > -    args.appendVector(Vector({ bindType, path, path > > > })); > > > + > > > +    // Canonicalize the source path, otherwise a symbolic link > > > could > > > +    // point to a location outside of the namespace. > > > +    char canonicalPath[PATH_MAX]; > > > +    if (!realpath(path, canonicalPath)) { > > > +        if (strlen(path) + 1 > PATH_MAX) > > > +            return;                  // too long of a path > > > +        strcpy(path, canonicalPath); // no-op > > > +    } > > > +    args.appendVector(Vector({ bindType, canonicalPath, > > > path })); > > >  } > > Apart from raw char arrays and string.h looking funny (and wrong) > > in > > C++, what is strcpy supposed to do here?  Would it work if we > > mapped > > canonicalPath to path (i.e. `ls path' in the container would be `ls > > canonicalPath' under the hood)? > > I first went the C++ solution, which is std::filesystem::canonical, > but was suggested in #webkitgtk (on the GNOME IRC server) to use the > POSIX realpath, already in use in that file, upon finding out that > their build system is configured to disallow the use of exceptions > (-fno-exceptions).  I refined the experiment as: > > --8<---------------cut here---------------start------------->8--- > diff --git > a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp > b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp > index 0d5dd4f6986d..1512b73a985d 100644 > --- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp > +++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp > @@ -325,6 +325,18 @@ enum class BindFlags { >      Device, >  }; >   > +static void bindSymlinksRealPath(Vector& args, const char* > path, > +                                 const char* bindOption = "--ro- > bind") > +{ > +    char realPath[PATH_MAX]; > + > +    if (realpath(path, realPath) && strcmp(path, realPath)) { > +        args.appendVector(Vector({ > +            bindOption, realPath, realPath, > +        })); > +    } > +} > + >  static void bindIfExists(Vector& args, const char* path, > BindFlags bindFlags = BindFlags::ReadOnly) >  { >      if (!path || path[0] == '\0') > @@ -337,6 +349,10 @@ static void bindIfExists(Vector& args, > const char* path, BindFlags bind >          bindType = "--ro-bind-try"; >      else >          bindType = "--bind-try"; > + > +    // Canonicalize the source path, otherwise a symbolic link could > +    // point to a location outside of the namespace. > +    bindSymlinksRealPath(args, path, bindType); >      args.appendVector(Vector({ bindType, path, path })); >  } >   > @@ -615,17 +631,6 @@ static void bindV4l(Vector& args) >      })); >  } >   > -static void bindSymlinksRealPath(Vector& args, const char* > path) > -{ > -    char realPath[PATH_MAX]; > - > -    if (realpath(path, realPath) && strcmp(path, realPath)) { > -        args.appendVector(Vector({ > -            "--ro-bind", realPath, realPath, > -        })); > -    } > -} > - >  // Translate a libseccomp error code into an error message. > libseccomp >  // mostly returns negative errno values such as -ENOMEM, but some >  // standard errno values are used for non-standard purposes where > their >  --8<---------------cut here---------------end--------------->8--- Note that Webkit has a FileSystem namespace with a realPath function that does std::filesystem::canonical already. > Which produced the intended bwrap arguments, but unfortunately that'd > still fail.  The issue seems to be related to attempt to bind > /etc/pulse/client.conf over something already existing there; it can > be simply reproduced with: > > --8<---------------cut here---------------start------------->8--- > $ guix shell bubblewrap -- bwrap --ro-bind /gnu /gnu \ >     --ro-bind /etc /etc \ >     --ro-bind /etc/pulse/client.conf /etc/pulse/client.conf \ >     /gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal- > 5.1.8/bin/bash > bwrap: Can't create file at /etc/pulse/client.conf: No such file or > directory > --8<---------------cut here---------------end--------------->8--- > > One thing to try would be to not bind mount client.conf; /etc/ is > already bind mounted as a whole.  If the resolved paths are all bind > mounted (which they are since we share the whole of /gnu), we should > be OK. Do we really need to bind all of /etc? I think it'd make sense to try and shrink that. Not bind-mounting it is not a solution IIUC. At least it appears that is the standard quo in which the symlink is unresolved. I think bubblewrap simply ignores symlinks due to their inherent TOCTOU characteristics and other "fun" things one could do with them. > [...] > > To be continued...