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 02AF25A026F for ; Wed, 16 Aug 2023 11:08:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692176934; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oc1pSTrh8qF31aIwj2Nz8nP2OW4cDVx0AAvvFpDYHGA=; b=FGYEMy37pE6Wukm31+Vv+nkQv+tOPP8WNeuc98IR5shnaI2HYPvem8Np0tp80hJ7GpN5in Ij0cXLZ1MmOXVf6cbp8munmyiaRn1GeRG3Ei4n6ASwLS0lAY0wrLz0M/TCsSufLv8jity6 zPPgCcrZ0torJjcYDPyrsEOJibsfDVI= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-RQmUy82oOHS6Ujv0pRDHqA-1; Wed, 16 Aug 2023 05:08:51 -0400 X-MC-Unique: RQmUy82oOHS6Ujv0pRDHqA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B98B31C05B13; Wed, 16 Aug 2023 09:08:50 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAB7C63F6D; Wed, 16 Aug 2023 09:08:49 +0000 (UTC) Date: Wed, 16 Aug 2023 11:08:47 +0200 From: Stefano Brivio To: "Richard W.M. Jones" Subject: Re: [PATCH 1/7] fedora: Install pasta as hard link to ensure SELinux file context match Message-ID: <20230816110847.19a57974@elisabeth> In-Reply-To: <20230816090308.GA7636@redhat.com> References: <20230816060038.870746-1-sbrivio@redhat.com> <20230816060038.870746-2-sbrivio@redhat.com> <20230816090308.GA7636@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: F73ZLV27YONNWRBLAC4IB4VCQBQ4VEJN X-Message-ID-Hash: F73ZLV27YONNWRBLAC4IB4VCQBQ4VEJN X-MailFrom: sbrivio@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, David Gibson 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, 16 Aug 2023 10:03:08 +0100 "Richard W.M. Jones" wrote: > On Wed, Aug 16, 2023 at 08:00:32AM +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. > > The patch and this cover note don't seem to do the same thing. It > appears to copy the binary, not make a hard link. (The comment in the > spec file seems to be correct.) Gosh, thanks for noticing, I sent out the wrong version. :/ That was another option that luckily we can avoid with hard links. I'll re-post in a bit. With a copy, by the way, we would have duplicate build-IDs in the RPM, and rpmtool would issue warnings (possibly problematic for debugging packages, I'm not sure). > It does appear to be possible to label symbolic links: > > $ touch test1 > $ chcon system_u:object_r:bin_t:s0 test1 > $ ln -s test1 test2 > $ chcon -h system_u:object_r:tmp_t:s0 test2 > $ ll -Z test1 test2 > -rw-r--r--. 1 rjones rjones system_u:object_r:bin_t:s0 0 Aug 16 10:00 test1 > lrwxrwxrwx. 1 rjones rjones system_u:object_r:tmp_t:s0 5 Aug 16 10:00 test2 -> test1 > > (which surprised me). But I don't know if SELinux does the right > thing or not in this case, or if something has changed in the kernel, > so I can't comment if copying is right or not. Right, yes, that's what we had before -- symbolic links with the "right" labels, but it stopped working a while ago (bisecting not really convenient, and it wasn't intended to work anyway, so whatever). -- Stefano