From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796035568; b=lAZl95FX7KW0G53BW4A2798d1nG8U5nRNSMOaClnyy98+I6sFJPH91krr4b++Bc/S6Up Ytq7NodYDgYXlj9Gxi4E5qJA8QhHO97F0hrEHNd6c6ZUVd1uGG0r+ieBcj/aVgOr5aC1A 6lY5CtmhsKRfJHQHwHI+/JgXieAaw32WKVmYOw+ZnjOviytHuO5BWEdxvs30tHB+n/Z7b 7FRAQ56d2ytiMTmx2IfUzpsRQgzvyCkXe0906etDa2XcXJyKrEBFAcKdV7D7IR8OhnRQn TJdnin1+hbXQ72X+PhlrKRpKpm9TAvMNyIKdh5qiGBCn9Z1ZI22hOugElFsJGMX00LQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796035568; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=HjKQebEnP3VfSdHUl4fM8ZlmXc8xB9iPqfGuOlf3sQc=; b=o+q93LpEMnACqFZl4AKo4lrGjC4p9UpzMSpC1nBlxYFbCF5g2BfIzeQyfa2+gFZkyQ8t 260l6jTwt8qIcMOUECoYz5ACkzB2MQzM68OCZ4GC2rQJRlKQFJV4f38YExzmduLpz/UU+ MjzrmJWzxhOAAnNvS8X6lDnHTWNz2rN+p2+9qNYo4+k25/PGhmo9BzpX4F/M+lLIK+szq VdeolAKxAgSZL1DU4Ip3lLi4v1Rwq94qtfs2pUcP269l8u5AAIgc6Lmj05F68CbQvn1OF 2tMKGgxkUwEhmyC6nrPL4ZTFx5vUqdRBeNeGLeU+hVmrWCwh+U5SEVJKbzQowq9bbXg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G6aeIG4f; arc=none smtp.remote-ip=209.85.128.42 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E91E606A32A for ; Mon, 30 Nov 2026 10:46:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6E91E606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G6aeIG4f Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4a5b2be99a8so80606635e9.2 for ; Mon, 30 Nov 2026 02:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796035567; x=1796640367; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=HjKQebEnP3VfSdHUl4fM8ZlmXc8xB9iPqfGuOlf3sQc=; b=G6aeIG4fisUyFk+Rlhj6J/s7hZWugCVhndG15HTzrfrL16MmMNfLLiwHQf958pC/eI elG1jkCW1qBb0l17MrnI3PxtNKmEJpdMqcZq+6yJbKpQ7QJeQIZQ9CPodegXEzl0aD1N J6yIeTz8s0hdwPdSyF0XRTCIJVzABZ4ZJTyv8nswzNvuiB/83EJ03YbVC08fQwWpAYuk tlk93YIBOY+fzfLRd/UjXK2A9nLvscx+8W33gh1/DPuiNp1yOwmRN5BYB3Z4x7z0otJn ug+x9eCHBoNmVcVwZBJhnK5AtsX2tis0egIZZ1ThPTfyXZLQgIkytJXV8zsp0Fil/E69 4hLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796035567; x=1796640367; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HjKQebEnP3VfSdHUl4fM8ZlmXc8xB9iPqfGuOlf3sQc=; b=hEPnFL1WEvnRgPoDFYGyRbvPZ7YPxqgAFl8buMu4S4RO42VRAmQ0D30SxkpKc5kkZb 9Yxn91vMskrLeblz+9+f+nYtbE9XT2QLHkXUL6q+0gd9Xyrc16hXzEiFsFMeTqwdHfrR doAIGkE11klgzvpCGops+BkP6wFYyJyv2kR8FGnYUFedkoxy3+MeInY/t2iJzqDYxTbH riIWTxTwpdpAAIbymFXgUO9SF0QBteFTc81I5MFhOlD7GU/BJsbebtgthRMjQc8rfZ90 Xrn6I909PC6zgf36a+hnXWKotL8/+ceNImGJ7Uut7ML7ZGXbTB5NBxmhTJgbZVjs2ta1 cceg== X-Forwarded-Encrypted: i=1; AL+hErG9g/YAoXdFqyFglNs6wh5HuKQ4K8mROlMd5fHZxcqbywKGmbh7AF/LIcb/Gf2m9q/uWE9ETp7E93uDW64=@vger.kernel.org X-Gm-Message-State: APuU4Z8YvNw9xtlwJa9aB+6AZT5yd51A0dNIeIhdafrpJyhLPTdfsGgG JtvoQG4M+TJqLVmMtEKAGqVxXtBXEZ3yz07NnUytxMXRveS8oFjTI6gZ X-Gm-Gg: AZFdTZfXC2FLhrrcI2EcDRS9wogCbEitHO3Ha84wsC9EVBhpearqs1hvwDYBeQhypGo yDMIt9jNXpOCDY/Y9puy0YxJabHTJ32pvhwxL4EqYTyMExX3lZDRNkhxNC3ozgDRUyGrPORrIl+ LDLpBYf2sOBWMPEqsm7JE8+S7GfkRo4LPDv1BG3NaUQpe7eF9y6YsAxop1yX6p6KM3mt3kufVAt /3r0yTDBeu4RYqIuBmifUNkKA7RSeAcpJmUCcYQ71uT4gEVFj6N5X6mq2Rk1ru9hCc8QvtvFM7x trYf8r5hr1amH/WrHisM6Wfyo4Wqy63lVs8kK0a++GkpKZ8SvJqIdG/gQKveXdW2/o8EfZjeq1z XHrbLQPl7NKdQTl74lP/XcI6+VmH3f+5MgB8eYbLwhGGG0NNA5pcAn7bbeMxEpwBEh8w1FEv0om jjkfY08hT40EDiWjN2abrd8qUynFoigACZ6UZdpAKCgdQCH4EV2cFBOEB19btHxA+af9ydd8Log bTKapSkmBUW5lIKpnqXlxLeVxGBVBpqCkGrorao6M6GexKcepSiIL0j2V+8byZfVbVFEO2Zx/XH ko9OD/1khNfDrkm3lHbfRGdHlt/ch2mrdEGm4ggAsuvk6EVNcTIFPSEaaeCMlzwYQe0RETMlzGM MBvl/16C+VRY= X-Received: by 2002:a05:600c:828e:b0:4a7:7f3f:6f8e with SMTP id 5b1f17b1804b1-4bb8878702emr698354295e9.0.1796035566491; Mon, 30 Nov 2026 02:46:06 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb88402ce9sm760259955e9.0.2026.11.30.02.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 02:46:06 -0800 (PST) Date: Mon, 30 Nov 2026 10:46:05 +0000 From: David Laight To: Jack Wallner Cc: Kees Cook , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Subject: Re: [PATCH 7/8] vdso/align: Preserve object size through PTR_ALIGN() Message-ID: <20261130104605.52646f5e@pumpkin> In-Reply-To: References: <20261129085612.22266-1-jackwallner@gmail.com> <20261129085612.22266-8-jackwallner@gmail.com> <20261129173816.1e27aa56@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 29 Nov 2026 12:47:41 -0800 Jack Wallner wrote: > Hi David, > > On Sun, 29 Nov 2026 17:38:16 +0000 David Laight wrote: > > scripts/bloat-o-meter will tell you exactly where the changes are. > > It might be that the code is actually larger in a few places. > > You're right, it is. I rebuilt every C file that calls PTR_ALIGN() for > the seven compiler and architecture pairs in the changelog (allmodconfig > with KASAN, UBSAN and KCOV off), once on the base tree and once with the > series applied, and compared each object. Function text, leaving out the > new test: > > x86-64 GCC +1394 bytes (+0.07%) > i386 GCC +980 bytes (+0.05%) > x86-64 Clang +758 bytes (+0.04%) > arm64 Clang +536 bytes (+0.02%) > powerpc Clang +1524 bytes (+0.06%) > arm Clang +7860 bytes (+0.38%) > riscv Clang +7496 bytes (+0.39%) > > Every architecture gets 12 to 18 new __fortify_panic() call sites (153 > to 166 on x86-64 GCC). Those are the checks the patch is meant to > enable, and on x86, arm64 and powerpc the functions that gained one > account for most of the growth; ovpn_aead_decrypt() gains two, for > example. The two largest growths on x86-64 GCC have no new check, > though: ath12k_dp_reoq_lut_setup() grows by 416 bytes and ismt_access() > by 256. > > On 32-bit arm and riscv the checks are a small part of it. There the > growth is spread over hundreds of functions (834 grow on arm, 351 on > riscv), and on arm 7360 of the 7860 bytes are in functions that gained > no check; gf128mul_lle() is the largest, at 184 bytes. So the changelog > is wrong to put the growth down to the object size. I don't know the > cause yet and will find out before v2. In a quick check (x - (x & 3)) seems to get compiled as (x & ~3). That might be enough to keep builtin_dynamic_object_size still returning a value while stopping the bloat. Although I'd have thought that the compiler could only track the size when it already knows the pointer in aligned. > > > How did that happen? > > Why isn't it just ((x) & ~((a) - 1)) > > It is older than this series. ed067d4a859f ("linux/kernel.h: Add > ALIGN_DOWN macro", 2017) replaced three local versions, the metag one > being the mask form, and kept the udl form, ALIGN(x - (a - 1), a). I'd looked them up as well. And traced back where the originals had come from. > The mask form would need a cast to typeof(x), or an unsigned 32-bit a > clears the top half of a 64-bit x: > > ((x) & ~((typeof(x))(a) - 1)) > > I'd rather keep that out of this series, but I can send it as a > separate patch if you think it is worth doing. It is definitely unrelated. > > Too long. > > Cut down to: > > /* > * Add the padding to @p instead of casting an integer back to a pointer, > * so the compiler still knows the size of the object @p points into. > * Use ALIGN() for integers. > */ Still long, maybe just: /* Add padding so the the compiler still knows the the size of @p */ David > > > Doesn't belong here at all. > > Dropped. That reasoning stays in the changelog only. > > Both will be in v2. > > Thanks, > Jack