Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp712696rbb; Sat, 24 Feb 2024 23:32:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWMSdAAVGlyjfHoG2ld2PXVa+gzo2ZZPc8yRKRsDRBNFVFCS1C+jaeSf8xOqxhPVLGABri5mvFSKBoaWSong8U1ZGnlRDVRU1UI03F+DQ== X-Google-Smtp-Source: AGHT+IHVlnxyHMJC9eQXxy6CwSX/G4bE9g0Jfa3AsGHxe2a0v2u5qE+rJ8vmiBcAZjrLnaqFOqiL X-Received: by 2002:a17:90a:d489:b0:299:4fba:7434 with SMTP id s9-20020a17090ad48900b002994fba7434mr2899090pju.0.1708846375313; Sat, 24 Feb 2024 23:32:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708846375; cv=pass; d=google.com; s=arc-20160816; b=x+xaGDDKjuJzC6cTyBzNDde/dbgb4w7/hX1KSs1WhNYwuryNfSjQEw0aJRVhifhV0J z+TR1SSmXbV9SSaIvZjwul3ec1IqTE/7Zaw+Zi8VHkM+rM6WvHOvkEsndHM5otiPXh7o lTKNa4fBOvYPPR+cNScnbCXzvjBkOYvV60LKd44dL07+rhna6lAPdafBDjl64NfrLRd+ mUfLtIpHoiZSqNy21uJi29F2bEDmswZbi3+2tyhMOTnevTm1MrQD6MR33A0d5UMSFv/Q x6JXsmHYOMpzDiZM6OuwQt61zOi/DspzFHb9QT0mJomWunIrXMD+cgT9P9tz2kThB7oM 70DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=it3fzbXAakYHy8201ZZf9XCQnW6iLZ+/V8xYvhU9PwQ=; fh=Nujibq2iyVLrh2FDtLwxaEZPidlNSSF+wGIGqpKn0Mk=; b=Q7wlPilgsd97mE+WrelCXUeXazgSMFCTRf2zu/hkIhgLCwipxEf28UHzYDQ9leJScT cx0eHcxYAAMV5Cv2/tHpudaSMq8JLELWiy9QKTmJ21VywKb32TEPUeb50Xb1uitm0RFE wxBoqUbNPWtkaEMYCqJ7LR9GfBXb0R+i/tIUvhmV6LAy+OtbwK0AXXlAfQeh+aOCAMoN lV5i69zGk8JjnxLdY+IzKw0EAgrVQ6ZbL3xSAcHR54UsEyJZiEPGN52OMjB7PaFl5MlA kIBAumy2pQx7kEexJo78srpDKxco9kzvTGNUR/JbLxa/4PfpdQ3bHP6+956hXnFxvh5O rnkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=TK+l+50W; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-80012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lx6-20020a17090b4b0600b0029a9f3f7b61si1816797pjb.95.2024.02.24.23.32.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 23:32:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=TK+l+50W; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-80012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 279F3B21598 for ; Sun, 25 Feb 2024 07:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19037DDC9; Sun, 25 Feb 2024 07:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="TK+l+50W" Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944BAD512; Sun, 25 Feb 2024 07:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708846358; cv=none; b=g4XbPxDn6WeqRpRGIhwp1BCWskuKGs3RKrhBa9mpSRVOYJkFP4pOwkRsZQZgzD80rXr3BLO57ekBCr0sjq6xtigkCwQ+VVCCePoexJc4OEkGRdml3YmKJ+0idTQcCT0jJrqSUKhJpY0zOyD3vfKj9bvFH21SzKEOC1QS+mgtA/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708846358; c=relaxed/simple; bh=LbYhaKq7d6bXAqiyvWbizJuhbnKxuNLIU02M3y8Swcs=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=HLOacz9tEyTrMDfJ6yVsLbqs+BAh6EXyB3LmSxNU0uBSE7U458b+DMYXAm9HsxrF9SYnwogehdHZD1i6rRLIbQ7fdTqas7RbyTV0parjyAKtVgxhcU8rOIvJrXa9pTO+PCj1u35T1v9JTifSaEl7hDuoDyZG8PzXb84+gO/+3wM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=TK+l+50W; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1708846348; bh=LbYhaKq7d6bXAqiyvWbizJuhbnKxuNLIU02M3y8Swcs=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=TK+l+50WWwXr8ks4dAV5JQieBO4oLWZV5/s59mdb7rr39ago66iuFwT9eif2fJArs Vy7/2uGWx3NiZJtQvpSi04KfGCF8fiEUe12ByW5iVUcmyXqnLREf/+aEkq/mOnkwo+ Ac5e3DL5QRkTxGQlzTtSjmNAnuCJPfTqTw+9p7m0= Received: from [127.0.0.1] (unknown [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id F3F1966D60; Sun, 25 Feb 2024 02:32:24 -0500 (EST) Message-ID: <24c47463f9b469bdc03e415d953d1ca926d83680.camel@xry111.site> Subject: Re: Chromium sandbox on LoongArch and statx -- seccomp deep argument inspection again? From: Xi Ruoyao To: Icenowy Zheng , Huacai Chen , WANG Xuerui Cc: linux-api@vger.kernel.org, Arnd Bergmann , Christian Brauner , Kees Cook , Xuefeng Li , Jianmin Lv , Xiaotian Wu , WANG Rui , Miao Wang , "loongarch@lists.linux.dev" , linux-arch , Linux Kernel Mailing List Date: Sun, 25 Feb 2024 15:32:23 +0800 In-Reply-To: References: <599df4a3-47a4-49be-9c81-8e21ea1f988a@xen0n.name> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Sun, 2024-02-25 at 14:51 +0800, Icenowy Zheng wrote: > > From my point of view, I prefer to "restore fstat", because we need > > to > > use the Chrome sandbox everyday (even though it hasn't been upstream > > by now). But I also hope "seccomp deep argument inspection" can be > > solved in the future. >=20 > My idea is this problem needs syscalls to be designed with deep > argument inspection in mind; syscalls before this should be considered > as historical error and get fixed by resotring old syscalls. I'd not consider fstat an error as using statx for fstat has a performance impact (severe for some workflows), and Linus has concluded "if the user wants fstat, give them fstat" for the performance issue: https://sourceware.org/pipermail/libc-alpha/2023-September/151365.html However we only want fstat (actually "newfstat" in fs/stat.c), and it seems we don't want to resurrect newstat, newlstat, newfstatat, etc. (or am I missing any benefit - performance or "just pleasing seccomp" - of them comparing to statx?) so we don't want to just define __ARCH_WANT_NEW_STAT. So it seems we need to add some new #if to fs/stat.c and include/uapi/asm-generic/unistd.h. And no, it's not a design issue of all other syscalls. It's just the design issue of seccomp. There's no way to design a syscall allowing seccomp to inspect a 100-character path in its argument unless refactoring seccomp entirely because we cannot fit a 100-character path into 8 registers. As at now people do use PTRACE_PEEKDATA for "deep inspection" (actually "debugging" the target process) but it obviously makes a very severe performance impact. Today the entire software industry is saying "do things in a declarative way" but seccomp is completely the opposite. It's auditing *how* the sandboxed application is doing things instead of *what* will be done. I've raised my against to seccomp and/or syscall allowlisting several times after seeing so many breakages like: - https://github.com/NetworkConfiguration/dhcpcd/issues/120 - https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/252 - https://blog.pintia.cn/2018/06/27/glibc-segmentation-fault/ - http://web.archive.org/web/20210126121421/http://acm.xidian.edu.cn/discus= s/thread.php?tid=3D148&cid=3D# (comment 3) but people just keep telling me "you are wrong, you don't understand security". Some of them even complain "seccomp is broken" as well but still keep using it. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University