From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 31DDE5A026D for ; Thu, 17 Aug 2023 09:53:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692258838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YqGjgvI+dbFaL+dknf1eyFbFjee3og2khjffgpKvVF0=; b=Mn/U6ac1IMmRZWNcNJUL8zf/IXNZfm9TZwCm4zA3iEEO+IrmjRbDX1IKE2AFOAYB6UAFvL e3H5D+P1stR15/ioJ1BAdHXj+1YiYZZID+GqUD+/WW6FLDWj0vd0I+CXTPhbCD38x2NeMK rmsl/KZ1UsKZtaIk6fqzaCOnHN6+1q0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-482-5b80m5m1O_K_IC7ck5DDvA-1; Thu, 17 Aug 2023 03:53:56 -0400 X-MC-Unique: 5b80m5m1O_K_IC7ck5DDvA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5329C101CC97 for ; Thu, 17 Aug 2023 07:53:56 +0000 (UTC) Received: from localhost (unknown [10.42.28.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ECBC140E950; Thu, 17 Aug 2023 07:53:56 +0000 (UTC) Date: Thu, 17 Aug 2023 08:53:55 +0100 From: "Richard W.M. Jones" To: Stefano Brivio Subject: Re: [PATCH v2 1/7] fedora: Install pasta as hard link to ensure SELinux file context match Message-ID: <20230817075355.GL7636@redhat.com> References: <20230816181730.2165306-1-sbrivio@redhat.com> <20230816181730.2165306-2-sbrivio@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230816181730.2165306-2-sbrivio@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Message-ID-Hash: HJSVBTPPI7HUDBHPKF34BGNXCSVWGVWV X-Message-ID-Hash: HJSVBTPPI7HUDBHPKF34BGNXCSVWGVWV X-MailFrom: rjones@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Aug 16, 2023 at 08:17:24PM +0200, Stefano Brivio wrote: > The Makefile installs symbolic links by default, which actually > worked at some point (not by design) with SELinux, but at least on > recent kernel versions it doesn't anymore: override pasta (and > pasta.avx2) with hard links. > > Otherwise, even if the links are labeled as pasta_exec_t, SELinux > will "resolve" them to passt_exec_t, and we'll have pasta running as > passt_t instead of pasta_t. > > Signed-off-by: Stefano Brivio > --- > contrib/fedora/passt.spec | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/contrib/fedora/passt.spec b/contrib/fedora/passt.spec > index 8d28ef6..d0c6895 100644 > --- a/contrib/fedora/passt.spec > +++ b/contrib/fedora/passt.spec > @@ -54,10 +54,17 @@ This package adds SELinux enforcement to passt(1) and pasta(1). > %make_build VERSION="%{version}-%{release}.%{_arch}" > > %install > + > %make_install DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_bindir} mandir=%{_mandir} docdir=%{_docdir}/%{name} > +# The Makefile creates symbolic links for pasta, but we need hard links for > +# SELinux file contexts to work as intended. Same with pasta.avx2 if present. > +ln -f %{buildroot}%{_bindir}/passt %{buildroot}%{_bindir}/pasta > %ifarch x86_64 > +ln -f %{buildroot}%{_bindir}/passt.avx2 %{buildroot}%{_bindir}/pasta.avx2 > + > ln -sr %{buildroot}%{_mandir}/man1/passt.1 %{buildroot}%{_mandir}/man1/passt.avx2.1 > ln -sr %{buildroot}%{_mandir}/man1/pasta.1 %{buildroot}%{_mandir}/man1/pasta.avx2.1 > +install -p -m 755 %{buildroot}%{_bindir}/passt.avx2 %{buildroot}%{_bindir}/pasta.avx2 > %endif Acked-by: Richard W.M. Jones ... although why not change the Makefile install rule instead so everyone gets this change? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top