From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (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 4229F1C2DAD for ; Mon, 2 Sep 2024 09:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725268817; cv=none; b=GE8HZr5jBZnPg3vIxNDEIk1vntUcL7f0aEzlqrf9eQZq1MZYrfRdyuDV8Ty2GUOAJVqfRCG93RBgDVcknYafcRxP91ZAyHiaGpAaYRu7nHuSA4c5eTquY6T4KZe34xXtNohQevsrtH78Ba03ObeRic3H4JsAXp7BcAcm8bfGym4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725268817; c=relaxed/simple; bh=JvMM200wwmg0a0pA6z93JHpy14mApdoUVfxh1+uRqug=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:References; b=geX86qGWvfQouhO5hDh7Yd+sUaIdxxQaX0L1wgOM0NQSsInvUhxFEZ5eMscUpYPAiB+xfi0AwJghqi5f2V9bMYwn17w0gQIENHJbMJWei7YvL8c/3OFN+kqC93w4tg+TJSvYMC7rqhZIo4WFbuJBgJiaLKuYMM3i3m/Cmh0FZxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=Z/jGXbD2; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Z/jGXbD2" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240902092012euoutp02625eb53e9b732317c27b75e994f6bdbb~xYtgZPMRL0772007720euoutp02k for ; Mon, 2 Sep 2024 09:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240902092012euoutp02625eb53e9b732317c27b75e994f6bdbb~xYtgZPMRL0772007720euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1725268812; bh=m5ERDXvm/e0P42wGNCE+IJxiECsJwJfb5bILlAF1580=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=Z/jGXbD2guPZBKvuyb7kmz31IZWg8eBtREHjck868C/jMfNUJ96vufx5nz93oXQ0B h+D2oCV8VsCoWNg+fCtapeqgZZ8xxysNpvhUrkPTeiRvPxd/Tcrm39rLxJyPrTxxOe Xh6BBDDsKz7vFGmZQR0tBgUbBRMGu0RsNl2oqPb4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240902092011eucas1p1bc93717556550f3a8439e52dc81c23d6~xYtf3vgS21567115671eucas1p1K; Mon, 2 Sep 2024 09:20:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 75.8D.09620.B4385D66; Mon, 2 Sep 2024 10:20:11 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240902092011eucas1p183edada5872e19c71d9fdfd49b752499~xYtfYUgio1814718147eucas1p1E; Mon, 2 Sep 2024 09:20:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240902092011eusmtrp2cad280d647787b5ebda5f44e4dd4da3e~xYtfXUCCJ2554725547eusmtrp2J; Mon, 2 Sep 2024 09:20:11 +0000 (GMT) X-AuditID: cbfec7f5-d1bff70000002594-42-66d5834b95ab Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AB.D6.14621.B4385D66; Mon, 2 Sep 2024 10:20:11 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240902092011eusmtip124d5cdec17832e5753681f0ef970cf48~xYtfG7wjI1102011020eusmtip1S; Mon, 2 Sep 2024 09:20:11 +0000 (GMT) Received: from localhost (106.110.32.44) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Sep 2024 10:20:09 +0100 Date: Mon, 2 Sep 2024 11:19:31 +0200 From: Joel Granados To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= CC: Luis Chamberlain , Kees Cook , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , , , , Subject: Re: [PATCH v2 1/6] sysctl: avoid spurious permanent empty tables Message-ID: <20240902091931.7al44ccdbbez2v3q@joelS2.panther.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7djPc7rezVfTDC6+MLH4/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AfL /QrTPRMi/y47b7mes/zMJNHqTUn+BfOMTdl3S6l/WZw9rWLGvTqpAPvJp15MiHoRJNuVtzxk /uVHClUSr6JOLDZJ/yNpFTZT83zvZPuJE8I8v24Qa6jdbp+cN3H6FWarOvUN71/YyfI/c7u6 fXP3C5UwDZtZQc99XzrciL62v7bwjumu2iP/Q78s+dD96u9j10eMLjpr8raHbZtbk2U0R0x6 7YVfq/4osRRnJBpqMRcVJwIAGePB7aUDAAA= X-CMS-MailID: 20240902092011eucas1p183edada5872e19c71d9fdfd49b752499 X-Msg-Generator: CA X-RootMTR: 20240824180517eucas1p1534e7cc27c4b7f5fdfe76313e2a12cf4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240824180517eucas1p1534e7cc27c4b7f5fdfe76313e2a12cf4 References: <20240805-sysctl-const-api-v2-0-52c85f02ee5e@weissschuh.net> <20240805-sysctl-const-api-v2-1-52c85f02ee5e@weissschuh.net> On Sat, Aug 24, 2024 at 08:05:08PM +0200, Thomas Weißschuh wrote: > Hi Joel, > > On 2024-08-05 11:39:35+0000, Thomas Weißschuh wrote: > > The test if a table is a permanently empty one, inspects the address of > > the registered ctl_table argument. > > However as sysctl_mount_point is an empty array and does not occupy and > > space it can end up sharing an address with another object in memory. > > If that other object itself is a "struct ctl_table" then registering > > that table will fail as it's incorrectly recognized as permanently empty. > > > > Avoid this issue by adding a dummy element to the array so that is not > > empty anymore. > > Explicitly register the table with zero elements as otherwise the dummy > > element would be recognized as a sentinel element which would lead to a > > runtime warning from the sysctl core. > > > > While the issue seems not being encountered at this time, this seems > > mostly to be due to luck. > > Also a future change, constifying sysctl_mount_point and root_table, can > > reliably trigger this issue on clang 18. > > > > Given that empty arrays are non-standard in the first place it seems > > prudent to avoid them if possible. > > > > Fixes: 4a7b29f65094 ("sysctl: move sysctl type to ctl_table_header") > > Fixes: a35dd3a786f5 ("sysctl: drop now unnecessary out-of-bounds check") > > Cc: stable@vger.kernel.org > > Signed-off-by: Thomas Weißschuh > > Any updates on this? > I fear it can theoretically also happen on v6.11. > This is already in next and will probably make it for v6.11. The "fixed" tag will make is so it is ported to 6.10. Best -- Joel Granados