From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796035568; b=eTn9gU3sXTFMsvLO/KRUtzA9doXvfwLNA5mDnuL8RCbxvqeLAFiIbEShkZ2JVperHJU1 kxZpcVFS+WdSpsDVvXcXCgIK82VvaA/MMP8wJa11d6rKwKgGZSOnNUnX2OyTPaQMcNWHm NOU6Exq/to8y7R4YvN76gc5LC1VQTJWihNHEHrB2KKO9ncq1kTDHbULhCrrFlB0SDl8cl +4zcN2SIkxAY3eyK0208BRsFW8LW1yqPyJWgtsXLoh3GIcahXO6glaj7g+K17wqeTasw/ a5JoW84de0rO20VebI3Nq9S1oUfsjL+ACUuHfBQU4F6llKma1XtxTvJ9/+CS2fZoYXg== 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=wZ42DH/YZ8FG8g1g2WFpgIajVsk7uT0evbJz4egEmc4cYxLEfRi4DaW85PSHa/8Ez3rT 3Bg9JNAb+bctsaj4FWWi1PsfA5d1wH5sDOon4Fp301CdJrNgNckTP9MHavmyFBztWGoKk +iaO1tT8IK5QouR61evntJg4slN5eZ+5Ysc2n60CN1OdGGGwIkNnJ+8GqlYe03lMMDEBi Vi80V22UcC66F1VIdbTNJiYnW7l1Hdj/vrOlwXUCoNrEKngDUqF6nRYKygPbymS43tIFA 9TfHGzSE3AJ3uGru3mJRBR6CBO3jmI+c6cE1ZST3XFN8L/KQvs3R07oXZp+kEYXDUiw== 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.221.53 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 7E3D7606A32C for ; Mon, 30 Nov 2026 10:46:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7E3D7606A32C 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-wr1-f53.google.com with SMTP id ffacd0b85a97d-4a3e706b5dfso6515736f8f.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=K13cWut6H+VXuYr/Sqx+3lg1fFlnQkryl07aNvM7q3EuRGPmzKeVzUmpKJMfBf8bNR 0z5zubWPyQuASYbwo6/bRfy6XtKiUHSoP+Cz/RVMR7jtcTXDD92ijAmAefpYQiEbsEE5 Ljncu1QB71Dpr53heVVhUEZ9o+igEMwPedBOCfGgtmBN3kaV0h8AlKxNWInEIHt5SYuX xjOi9IyPn3PzqHOW6uXCV0wmDW/LkDPlMiedNQtx7oqPZiY6z735uTTGaz21DUQvjHZO Ie3ITegPKDrardZfnsIeRPUCW9xjlEJjA2Bq6PnZFLvqFt4mBAboTYHHO5SZLN+lmUl8 C67g== X-Forwarded-Encrypted: i=1; AL+hErFeMomMTX5qffZfni94SJ85d4eywsd4ENZw2X3n3E2ArfrGdIXMGTzRWXB0790sl98NJGDhrZ1vmBLra1U+z24=@vger.kernel.org X-Gm-Message-State: APuU4Z+Gp19ehqS2HkYO/l+a9RNbGlOLtTkNztch76eEfJuKaqfDAe2i 504yHo6oZqucOq4Q5i2b1uQUZJS2Jt7zwwdzoNyQ+YtLxevucMaDRU10 X-Gm-Gg: AZFdTZemmh0b2s+Mp8NI+2fmagGcJ80N+zYYQWuekXBpjimjU4cxvFCc5Cv/xGkFpiR bYN0p+sqYwBrkpGglWNmAskueivh0SNM9PZ2LO4C906deJ0wHmN/VwgPuhqGEYR62IzMLGwQ8DR TbsP/5YIrjmLv8B9B7n4JHr3Y2ek/blDS1ugFztgGcW+EtDQujOkzfi7qp/s3Axu0hTbGhLGRO2 xumYNGbUaoT2mv+a5K7krINcRzOTVISFCL1SaXfOjDcc5VivO2k9ZKCNAawq0T5v2fxUiTrIKsF 3G0qFmHEDLOxeUGs3/aEXTTI2Dzud4++k1pMq+/xd26hPBjeQnH1JCZoRTVgLuTazKzM2uUHiAg Eb+UJTceIcpadzL56+2unOzEQjb/b2E9Xzo7bvgIRnt+ykKGrmzPfTjVOcfcGQ5mVoD2Q9Phmi3 zrwTocuEmrRu6wG3sjffbO5UJ4PR9HiMNgzbtBF+abYZiDgXYHxRQTgtFRvsaJVbyi59r5ZjujF mIMwDX+O1+iuJB7FVtmRkZ4wMEKtQp6CqTyXHf8oxIZbZvZnJVb5BZ30fYHOjDf8lTterTjGMQQ jpG0yO/HwBcR04UJyYSxMR2erjpe+3bMz8O6JaP5Gux/4wDQ0qWiUS7t3MGi9Oze2Lzh2cn4fkx TRWrZyrOFzXA= 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-hardening@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