[PATCH v2 0/2] hardening: Enable i386 FORTIFY_SOURCE on Clang 16+

2025-03-07 Thread Kees Cook
Hi, This drops -ffreestanding for i386 unconditionally for GCC, and on Clang version 16 and later. FORTIFY_SOURCE depends on the libcall optimizations made without -ffreestanding on Clang. On GCC, there is no expected differences. With that done, it's possible to gain Clang FORTIFY_SOURCE coverage

[PATCH v2 1/2] x86/build: Remove -ffreestanding on i386 with GCC

2025-03-07 Thread Kees Cook
The use of -ffreestanding is a leftover that is only needed for certain versions of Clang. Adjust this to be Clang-only. A later patch will make this a versioned check. Signed-off-by: Kees Cook --- Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Pet

[PATCH v2 2/2] hardening: Enable i386 FORTIFY_SOURCE on Clang 16+

2025-03-07 Thread Kees Cook
The i386 regparm bug exposed with FORTIFY_SOURCE with Clang was fixed in Clang 16[1]. Link: https://github.com/llvm/llvm-project/commit/c167c0a4dcdb998affb2756ce76903a12f7d8ca5 [1] Signed-off-by: Kees Cook --- arch/x86/Makefile | 2 +- security/Kconfig.hardening | 2 +- 2 files change

Re: [PATCH] string: Disable read_word_at_a_time() optimizations if kernel MTE is enabled

2025-03-07 Thread Kees Cook
On Fri, Mar 07, 2025 at 06:33:13PM -0800, Peter Collingbourne wrote: > The optimized strscpy() and dentry_string_cmp() routines will read 8 > unaligned bytes at a time via the function read_word_at_a_time(), but > this is incompatible with MTE which will fault on a partially invalid > read. The att

[PATCH] string: Disable read_word_at_a_time() optimizations if kernel MTE is enabled

2025-03-07 Thread Peter Collingbourne
The optimized strscpy() and dentry_string_cmp() routines will read 8 unaligned bytes at a time via the function read_word_at_a_time(), but this is incompatible with MTE which will fault on a partially invalid read. The attributes on read_word_at_a_time() that disable KASAN are invisible to the CPU

[PATCH v2 0/2] Add Xiaomi Redmi Note 8 support

2025-03-07 Thread Gabriel Gonzales
This patchset introduces support for the Redmi Note 8 (codenamed ginkgo). This series is a follow-up to v1 (message-id in in-reply-to header) which was sent without a cover letter. Changes in v2: - Add missing cover letter - Fix up commit message for schema Gabriel Gonzales (2): dt-bindings:

[PATCH v2 2/2] arm64: dts: qcom: sm6125: Initial support for xiaomi-ginkgo

2025-03-07 Thread Gabriel Gonzales
Add support for the Xiaomi Redmi Note 8 based on the SM6125 SoC. Defined features: - dmesg output to bootloader preconfigured display - USB - eMMC - SD card - SMD RPM regulators - Volume Up, Down and Power buttons Signed-off-by: Gabriel Gonzales --- arch/arm64/boot/dts/qcom/Makefile

[PATCH v2 1/2] dt-bindings: arm: qcom: Add Xiaomi Redmi Note 8

2025-03-07 Thread Gabriel Gonzales
Document the Xiaomi Redmi Note 8 (codenamed ginkgo), which is based off the SM6125 SoC. Signed-off-by: Gabriel Gonzales --- Documentation/devicetree/bindings/arm/qcom.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/arm/qcom.yaml b/Documentation/devicet

Re: [RFC][PATCH] overflow: Twiddle with struct_size()

2025-03-07 Thread Kees Cook
On Wed, Mar 05, 2025 at 02:43:15PM +0100, Peter Zijlstra wrote: > Hi Kees, > > I keep getting hit by the struct_size() brigade, and I keep having > trouble reading that macro. > > I had a wee poke and ended up with the below, WDYT? Ah, and to clarify, this is just for readability? (There have be

Re: [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter

2025-03-07 Thread Justin Stitt
Hi, On Thu, Mar 06, 2025 at 08:19:11PM -0800, Kees Cook wrote: > Limit integer wrap-around mitigation to only the "size_t" type (for > now). Notably this covers all special functions/builtins that return > "size_t", like sizeof(). This remains an experimental feature and is > likely to be replaced

Re: [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter

2025-03-07 Thread Justin Stitt
On Thu, Mar 06, 2025 at 08:19:11PM -0800, Kees Cook wrote: > Limit integer wrap-around mitigation to only the "size_t" type (for > now). Notably this covers all special functions/builtins that return > "size_t", like sizeof(). This remains an experimental feature and is > likely to be replaced with

Re: [PATCH] hardening: Enable i386 FORTIFY_SOURCE on Clang 16+

2025-03-07 Thread Kees Cook
On March 7, 2025 1:47:34 PM PST, Nathan Chancellor wrote: >On Tue, Mar 04, 2025 at 09:50:44AM -0800, Kees Cook wrote: >> On Mon, 03 Mar 2025 13:49:37 -0800, Kees Cook wrote: >> > The i386 regparm bug exposed with FORTIFY_SOURCE with Clang was fixed >> > in Clang 16[1]. >> > >> > >> >> Applie

Re: [PATCH 2/3] ubsan/overflow: Enable pattern exclusions

2025-03-07 Thread Justin Stitt
Hi, On Thu, Mar 06, 2025 at 08:19:10PM -0800, Kees Cook wrote: > To make integer wrap-around mitigation actually useful, the associated > sanitizers must not instrument cases where the wrap-around is explicitly > defined (e.g. "-2UL"), being tested for (e.g. "if (a + b < a)"), or > where it has no

Re: [PATCH] hardening: Enable i386 FORTIFY_SOURCE on Clang 16+

2025-03-07 Thread Nathan Chancellor
On Fri, Mar 07, 2025 at 02:57:06PM -0800, Kees Cook wrote: > > > On March 7, 2025 1:47:34 PM PST, Nathan Chancellor wrote: > >On Tue, Mar 04, 2025 at 09:50:44AM -0800, Kees Cook wrote: > >> On Mon, 03 Mar 2025 13:49:37 -0800, Kees Cook wrote: > >> > The i386 regparm bug exposed with FORTIFY_SOUR

Re: [PATCH] hardening: Enable i386 FORTIFY_SOURCE on Clang 16+

2025-03-07 Thread Nathan Chancellor
On Tue, Mar 04, 2025 at 09:50:44AM -0800, Kees Cook wrote: > On Mon, 03 Mar 2025 13:49:37 -0800, Kees Cook wrote: > > The i386 regparm bug exposed with FORTIFY_SOURCE with Clang was fixed > > in Clang 16[1]. > > > > > > Applied to for-next/hardening, thanks! > > [1/1] hardening: Enable i386 FOR

[PATCH stable v5.4 v2 3/3] overflow: Allow mixed type arguments

2025-03-07 Thread Florian Fainelli
From: Kees Cook commit d219d2a9a92e39aa92799efe8f2aa21259b6dd82 upstream When the check_[op]_overflow() helpers were introduced, all arguments were required to be the same type to make the fallback macros simpler. However, now that the fallback macros have been removed[1], it is fine to allow mi

Re: [RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-03-07 Thread Thorsten Blum
On 3. Mar 2025, at 19:44, Kees Cook wrote: > On Mon, Mar 03, 2025 at 12:02:22AM +0100, Thorsten Blum wrote: >> Convert mux_control_ops to a flexible array member at the end of the >> mux_chip struct and add the __counted_by() compiler attribute to >> improve access bounds-checking via CONFIG_UBSAN_

[PATCH] module: Replace deprecated strncpy() with strscpy()

2025-03-07 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. The destination buffer ownername is only used with "%s" format strings and must therefore be NUL-terminated, but not NUL- padded. No functional changes intended. Link: https://github.com/KSPP/linux/issues/90 Cc