From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 837A9C531F9 for ; Mon, 27 Jul 2026 01:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=X5WxXKv3tM/juHDs7F+fi+T5krsvThiBbf/3eNS3EFY=; b=IzMd7S3tCZSKOGIho574tJmWK0 qKf/KxaqS95+BHPWmpasiQq55LemsAP9UWEiD4wx55aofOkhKmTnYHLV78bRwVF4ZIKITBEqKXCnt AinjTMu6CYtogtaD5ZiOciC5L8udmTBXX8F2OOYH3VLwNCs7O7YMYFMHot36j99SLS0A5IxerFt/Y b+GC4D11TaseIlwUfdwCVCdEa4fT2Dix6O3g4zIWrDmwSMvoj8v/8CMuEGfAejhzaBZif0sX1JN6y EYYYVYpj151jEj9fGLfseXvLItGMA8Pa5+V4FzgZYxkqbal6ZcwXdoc37TAK4JHP5nnXD/Uvctuj+ Ijiz0w/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1woAHx-00000001mUa-0MKV; Mon, 27 Jul 2026 01:37:53 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1woAHu-00000001mTl-2ULw for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2026 01:37:51 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-47f633e6058so1875634f8f.0 for ; Sun, 26 Jul 2026 18:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785116269; x=1785721069; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=X5WxXKv3tM/juHDs7F+fi+T5krsvThiBbf/3eNS3EFY=; b=r31VW/szIs+hUAkx5LU7FVFVVw0kaEriDn8C48+82Qg3aRwXi1BPYtykllApIFeA40 M2hnvl48rDE1f4VUn2wLq34JdSTwt3sP02k0b58F5pcc0rEW1hR1SKKCppUAyWDXSgSD 84p/y5QI9/jsKrNPIUNVqvrGdWUfZvPBcjKCWOEs1jifC3RL+MYpxZpEB5yoQYSaI/Kd Osxp0nQLghv/F1KA+SUlOkZjNUKV8eb/pkdN34pcNzwxyrQmbxEj+CJMyGR+rkq5abII yMg37hvrk/1PzK09R1Zl2AfhoaV+T0tQnpvVHQ30f0Hxu5D9BKiueOFFNae+L3SEZ4RW iJVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785116269; x=1785721069; h=in-reply-to:content-disposition:content-type:mime-version :references: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=X5WxXKv3tM/juHDs7F+fi+T5krsvThiBbf/3eNS3EFY=; b=iIle/TrqGfeCS0AO36r/gHHbVVBLKJVZHICVhPPEOaXxvwQwYOxcf8GN4hAeyMZCLv CwXm3DZ++iwne3ieW5Jg1D8PRwjXG08Qc15TYW5lqtZQeGnCC9a22Vf6t7DFgDlmy0Pn J6TjjHvSc/W/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85a97d-47f9fc8c4dbmr8796069f8f.11.1785116268631; Sun, 26 Jul 2026 18:37:48 -0700 (PDT) Received: from unknown748F3CBA5068 (dynamic-095-114-116-215.95.114.pool.telefonica.de. [95.114.116.215]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85bb57cfsm45492653f8f.11.2026.07.26.18.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jul 2026 18:37:48 -0700 (PDT) Date: Mon, 27 Jul 2026 03:37:16 +0200 From: Karl Mehltretter To: Kees Cook Cc: "Russell King (Oracle)" , Linus Walleij , Nathan Chancellor , Sami Tolvanen , Zhen Lei , Arnd Bergmann , =?utf-8?Q?Micha=C5=82?= Pecio , Sebastian Andrzej Siewior , linux-arm-kernel@lists.infradead.org, Russell King , Will Deacon , Mark Rutland , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH v3] ARM: traps: Implement KCFI trap handler for ARM32 Message-ID: References: <20260715175223.make.153-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260715175223.make.153-kees@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260726_183750_637134_CB84F7F7 X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 15, 2026 at 10:52:27AM +0100, Kees Cook wrote: > + /* Check for EOR/EORS immediate: cccc 0010 0x1n Rn Rd immediate */ > + if ((instr_prev & 0x0fe00000) == 0x02200000) { > + /* Extract EOR immediate value and XOR to reconstruct type */ > + u32 rotate = (instr_prev >> 8) & 0xf; > + u32 imm8 = instr_prev & 0xff; > + u32 imm32 = (imm8 >> (rotate * 2)) | (imm8 << (32 - rotate * 2)); With CONFIG_UBSAN_SHIFT=y, I reproduced the following in QEMU with GCC v14 KCFI and LKDTM CFI_FORWARD_PROTO: UBSAN: shift-out-of-bounds in arch/arm/kernel/traps.c:555:48 shift exponent 32 is too large for 32-bit type 'unsigned int' Could this use ror32() from instead? Thanks, Karl