From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 DEC443ECBF9 for ; Fri, 6 Mar 2026 16:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772815070; cv=none; b=j+VFuOWWqf1BFximSEbVqr/adgP/XKWox5t/Wk7g/orSu/WiFDkRtW1Tc4280WxvQ2NUwm6yV+A032GbiGEOlhKUqSpkL2Eu0GZjeEM/4OXJJvlHYabdsgEVDUPU7A88/DOPVJlyO1Rm8yW/eGV7DWoC5Bb6bFJE3n6R21LhYCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772815070; c=relaxed/simple; bh=JHj2OY6d8eKbQeRapfnCJ+S/9OtFltd8Xt0exu2oABo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qpxVI3lPm/1FDVj58aWN2Xz71SKe7R56UxX+/TiajYH6Y8mPwm5l3k1zK4yuAcRcAUg0lUR+yKz+mKjhYGrzhk0KKo64b/CAsBR4Zn3LteuKQmUvV3+VGBuIyEDtaYBPq+IKagCPL3eI6+En8kWEhgITwbQo9Yz60U+16BQ7Deo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=P1FKTYVy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HkYs3Fkh; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="P1FKTYVy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HkYs3Fkh" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 626FrCGH082801 for ; Fri, 6 Mar 2026 16:37:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=GAQ9pLciHvE 89gx35mXrNVxSf1XEwFKPuDx6QiEHunQ=; b=P1FKTYVyaDTRWBui++G0QZpvcf3 kRJUM5T8j7aH3DAqhO9UFO8Ln03Jxu8mO4M/T/jwUhy4YoHS9jxS6n7vPzw8e362 71SnrJLpEQtBWBWm1ij/sp+hZyv8gsmmgRPiMnh+gMd02+53V5JwxKvGq49FdeH2 ocyG2/0uwDG6u73p0UwkMpvPZRvcq26z8gr+1aVCF1nqMINH5RKc0Pwq6SkUO9Vs Y7BYlpOe/uXWlUmHPn8byD6p3BTzuIKWgY4xZK18rSotEzHQl6zKzFxRxG7KOi+9 uWUT7XGpYMcblNJThe34GwGIXOjy/NLVtTvvo0V3NEL0LvnrIcLwM5lT4bg== Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cqv98hb2q-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 16:37:47 +0000 (GMT) Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-899bef1ea49so484673076d6.1 for ; Fri, 06 Mar 2026 08:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772815066; x=1773419866; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GAQ9pLciHvE89gx35mXrNVxSf1XEwFKPuDx6QiEHunQ=; b=HkYs3FkhujN1/f0I+btKCFlWveB2ySHXuasO6tTMNfRQTCzG76b0DaKG6V7CTPeiOX /4vjeQrE5WIs3c9d6jNiPm5b0FVupCn0mLuEOiAf4puwwe9sr8Lz7jKeDOgEoeKK9LbS 9UqVCc35D/cYR6uH5vl9JkZpoGJBXdJsgN06CnpRw/uZGGs4Sa7Vqhis1cPq5hvpLjx0 qNhNhoi9r2G8/uo2UN4Ad5NbkhFF2yRT5F/R+7vhbCAlleLsIqPu8abuRRO/QKdXGvek AII0hZmVFTGFXynfj5gZ4OzW61AnuB+hP5HVJk+RQJ4HmyzL13jG//IwmHD3tsjAskLm JfHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772815066; x=1773419866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GAQ9pLciHvE89gx35mXrNVxSf1XEwFKPuDx6QiEHunQ=; b=kh4cK4f+xqIxace73Asy5JsjWUm5GFhZyfR5yOsiA9zgFIjL977J+QHW/epRGBKOkv 3wmnm8pk0mk+YRRjvB3uPHjmDTkQ/Hx5KU/wHDxG5iGmSjBtdQlhfl9o1U2iCJNxH+2r NmGJrI5p/ZEAWxgiYLUkGQmJ1KstFET95KbK/AbzKFiwRJbp7KK/2xnWDYwJe62DsVxQ VwsX4AMLa/IsztpUzvM16IcvOOotwx4kaqzgHgijVUflIenJaP4QcZHX1qJRjTkTqdQq nBSrZHYPGebs7Ab6Q80iWTwlnbSVjbTYN6O+6UIAfCU1yiOFy4y86wTeZzkLbLO+5EHa 0ZpA== X-Forwarded-Encrypted: i=1; AJvYcCXOmblccpAkeuDJ7T+Tz/0pGAXhjGQwf7XhuYwI6WJxPMSxSrmVUznXoOGqq2A3riHYgZhE9XAd1rCYsqc=@vger.kernel.org X-Gm-Message-State: AOJu0Yxrv48tHEz8RwOkXSfS3E84CPS8VwRhg0yb+ia0ALAhijXnje8/ dxcw4vy39jHLJhNYdhZ49egtEcsimfXjY5JmEbdlVlcReIMERNu6yL1rTxiZEyLiiw+bcowu68U XML0r1fJw6x8HkU7JqVdVig2WYVyVLazuVy5KrAiQ93KuZpypOYaA2xshMZZqcVndGAs= X-Gm-Gg: ATEYQzxOx8ULxe4XktsVA95eT3X04QzJ5iLn4iWA8m7aVIdhKPWScTNCHAf28b6GFuw 6J96S4uPB/kInHeKxSXjOTfFIsvoMDBVoJPoUKxKxIpTypluAsGlH+vDG9zX9k8/87NcG1ZoShF CLzwlPOPUAJnV/h+CSrJU81y6XyCn/TIjVOhUSxouubGL10lQLP7w+Ht1W6i8/FrtU8BRUKsgL9 D7exsyXTLQEy8xHuXW/8+zjPc1s5psLFzEp6SqwXya1MIrCpuw+CfbP11prVBHqyVrX+tR5Hb/l xVtf5wOf7twdWvXWyouravPtCg4AJBWwJXaMJTn+V0mCJ/0IgYGgqfbLOIPMF/DN/o+vioJsx9/ mMLasKhVUVKvOJ3rg3R885nhnJblbTyHAH4vOaTIY3Mgc+gbZWiIZl/WRTjOeuA== X-Received: by 2002:a05:620a:489b:b0:8c7:155a:6d03 with SMTP id af79cd13be357-8cd6d4e70b4mr377712385a.58.1772815066081; Fri, 06 Mar 2026 08:37:46 -0800 (PST) X-Received: by 2002:a05:620a:489b:b0:8c7:155a:6d03 with SMTP id af79cd13be357-8cd6d4e70b4mr377707685a.58.1772815065512; Fri, 06 Mar 2026 08:37:45 -0800 (PST) Received: from hu-yabdulra-ams.qualcomm.com ([212.136.9.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fb3666asm112694935e9.14.2026.03.06.08.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 08:37:44 -0800 (PST) From: Youssef Samir To: ebiggers@kernel.org Cc: amadeuszx.slawinski@linux.intel.com, arnd@arndb.de, dakr@kernel.org, gregkh@linuxfoundation.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, mcgrof@kernel.org, rafael@kernel.org, russ.weight@linux.dev, jeff.hugo@oss.qualcomm.com, troy.hanson@oss.qualcomm.com Subject: Re: [PATCH] firmware_loader: use SHA-256 library API instead of crypto_shash API Date: Fri, 6 Mar 2026 17:37:43 +0100 Message-ID: <20260306163744.1495881-1-youssef.abdulrahman@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250428190909.852705-1-ebiggers@kernel.org> References: <20250428190909.852705-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 0SV7D7P6dqEtz4um5-LTeYEsILEl0_gq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDE1NyBTYWx0ZWRfX7zp9zOhAC6MO vgaVajbdAdMk8q5PCm/Gxm5bas3BrQGNPs806wG4TmjdJRxdc+mswyKb5KccoW+OIZiUIMCpJsV tbeTg/X+F4ohyKit7KHULH4OOhIPu6v/E6pCBGh2JpXyv80+LlzRDZvPZifQLSpiQEiO8awok1c WsCFG9V8eCwFKVqTp+wW3EBOXd42/F1Gb17vQF60Cuo8OXDKpzjp+LwiLHLtRcs0pq8Sx1sAuTy RHPi6PHpoRJbyhBpebzYIv1kZNpyrtKjMHjoO0k1U9c+VHVx/SYl5hqg0wi5/yGb5tfuF6GmWNt Hi/WsfEKHUu+tf5nUK/Jl/bgW6dwMC81dUlhJDEpnrwmHv/s+gYHHhmVFwO8l1Hq8Vmu3C1S1gq EFDEAyNOlMFgIIk/iIodl6pv6JC83YdWpvUz2Pj2Cci92khF1DBkiyGAONMwQbqTCvAXwLJIJuh V2PHRObNfqNgKq9ZUsQ== X-Authority-Analysis: v=2.4 cv=LbcxKzfi c=1 sm=1 tr=0 ts=69ab02db cx=c_pps a=UgVkIMxJMSkC9lv97toC5g==:117 a=dNlqnMcrdpbb+gQrTujlOQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=FNyBlpCuAAAA:8 a=1XWaLZrsAAAA:8 a=RQVng53ib3JEPYZLgFUA:9 a=1HOtulTD9v-eNWfpl4qZ:22 a=RlW-AWeGUCXs_Nkyno-6:22 X-Proofpoint-ORIG-GUID: 0SV7D7P6dqEtz4um5-LTeYEsILEl0_gq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-06_05,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 bulkscore=0 clxscore=1011 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060157 On 4/28/2025 8:09 PM, Eric Biggers wrote: > From: Eric Biggers >=20 > This user of SHA-256 does not support any other algorithm, so the > crypto_shash abstraction provides no value. Just use the SHA-256 > library API instead, which is much simpler and easier to use. >=20 > Also take advantage of printk's built-in hex conversion using %*phN. >=20 > Signed-off-by: Eric Biggers > --- >=20 > This patch is targeting the firmware_loader tree for 6.16. Hi Eric, An issue has been found on kernel versions older than v6.16, where a firmwa= re file larger than 2GB and is not divisible by SHA256_BLOCK_SIZE (64b) will a= lways lead to a page fault. The first size that fits this criteria is 21474= 83649b. It is also worth noting that any subsequent loads regardless of the= size or divisibility by 64, will lead to another page fault. I've mainly tested this with drivers/accel/qaic on 6.8.0-62-generic, but te= chnically this should affect any code that uses the firmware loader on a ke= rnel version older than v6.16 with CONFIG_FW_LOADER_DEBUG enabled, includin= g the stable kernels. This can be reproduced by creating a dummy binary file of a size that fits = the criteria listed above, then compress it using zstd to allow _request_fi= rmware() to open it. This patch appears to have fixed the issue so I suggest backporting it, but I also noticed that it relies on changes that were introduced in this serie= s: https://lore.kernel.org/lkml/cover.1745734678.git.herbert@gondor.apana.org.= au/ Below is the BUG splat: [1667258.914177] BUG: unable to handle page fault for address: ffffb731b3fb= cd40 [1667258.914188] #PF: supervisor read access in kernel mode [1667258.914193] #PF: error_code(0x0000) - not-present page [1667258.914198] PGD 100000067 P4D 100000067 PUD 1002d4067 PMD 529eec067 PT= E 0 [1667258.914208] Oops: 0000 [#3] PREEMPT SMP PTI [1667258.914214] CPU: 11 PID: 1252644 Comm: kworker/11:1 Tainted: P D = W OE 6.8.0-62-generic #65-Ubuntu [1667258.914223] Hardware name: Wiwynn Twin Lakes MP/Twin Lakes Passive MP,= BIOS YMGPE07 12/23/2019 [1667258.914229] Workqueue: events sahara_processing [qaic] [1667258.914257] RIP: 0010:memcpy_orig+0x105/0x130 [1667258.914267] Code: 0f 1f 44 00 00 83 fa 04 72 1b 8b 0e 44 8b 44 16 fc 8= 9 0f 44 89 44 17 fc c3 cc cc cc cc 0f 1f 84 00 00 00 00 00 83 ea 01 72 19 <= 0f> b6 0e 74 12 4c 0f b6 46 01 4c 0f b6 0c 16 44 88 47 01 44 88 0c [1667258.914278] RSP: 0018:ffffb731a3c57c78 EFLAGS: 00010202 [1667258.914284] RAX: ffffa0ac564f41b0 RBX: ffffa0ac564f41b0 RCX: 00000000d= 7af7212 [1667258.914290] RDX: 0000000000000001 RSI: ffffb731b3fbcd40 RDI: ffffa0ac5= 64f41b0 [1667258.914295] RBP: ffffb731a3c57ca8 R08: 000000005ab6c582 R09: 000000007= 2a12f7b [1667258.914301] R10: 0000000064f65b73 R11: 000000001cb47ae9 R12: ffffffff9= 3d71d40 [1667258.914306] R13: ffffb731b3fbcd40 R14: 0000000000000002 R15: ffffb7322= 024b000 [1667258.914311] FS: 0000000000000000(0000) GS:ffffa0bb7f580000(0000) knlG= S:0000000000000000 [1667258.914318] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [1667258.914323] CR2: ffffb731b3fbcd40 CR3: 0000000b09e3c005 CR4: 000000000= 07706f0 [1667258.914329] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 000000000= 0000000 [1667258.914334] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 000000000= 0000400 [1667258.914339] PKRU: 55555554 [1667258.914342] Call Trace: [1667258.914346] [1667258.914350] ? show_regs+0x6d/0x80 [1667258.914358] ? __die+0x24/0x80 [1667258.914364] ? page_fault_oops+0x99/0x1b0 [1667258.914372] ? kernelmode_fixup_or_oops.isra.0+0x69/0x90 [1667258.914380] ? __bad_area_nosemaphore+0x19e/0x2c0 [1667258.914388] ? bad_area_nosemaphore+0x16/0x30 [1667258.914394] ? do_kern_addr_fault+0x7b/0xa0 [1667258.914400] ? exc_page_fault+0x1a4/0x1b0 [1667258.914407] ? asm_exc_page_fault+0x27/0x30 [1667258.914417] ? memcpy_orig+0x105/0x130 [1667258.914425] ? lib_sha256_base_do_update.isra.0+0x5d/0x1d0 [sha256_sss= e3] [1667258.914433] ? __pfx_sha256_transform_rorx+0x10/0x10 [sha256_ssse3] [1667258.914440] sha256_finup+0xf5/0x150 [sha256_ssse3] [1667258.914447] sha256_avx2_digest+0x55/0x70 [sha256_ssse3] [1667258.914453] crypto_shash_digest+0x2a/0x60 [1667258.914460] fw_log_firmware_info+0x113/0x1b0 [1667258.914469] _request_firmware+0x19d/0x4b0 [1667258.914476] firmware_request_nowarn+0x36/0x60 [1667258.914482] sahara_processing+0x399/0x710 [qaic] [1667258.914501] process_one_work+0x181/0x3a0 [1667258.914508] worker_thread+0x306/0x440 [1667258.914514] ? _raw_spin_lock_irqsave+0xe/0x20 [1667258.914521] ? __pfx_worker_thread+0x10/0x10 [1667258.914526] kthread+0xef/0x120 [1667258.914533] ? __pfx_kthread+0x10/0x10 [1667258.914540] ret_from_fork+0x44/0x70 [1667258.914546] ? __pfx_kthread+0x10/0x10 [1667258.914552] ret_from_fork_asm+0x1b/0x30 [1667258.914561] [1667258.914564] Modules linked in: tls nfsv3 rpcsec_gss_krb5 nfsv4 nfs net= fs snd_seq_dummy snd_hrtimer snd_seq_midi snd_seq_midi_event snd_rawmidi sn= d_seq snd_seq_device snd_timer snd soundcore qrtr_mhi(OE) qrtr(OE) xt_connt= rack xt_MASQUERADE bridge stp llc xt_set ip_set nft_chain_nat nf_nat nf_con= ntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_addrtype nft_compat nf_tables xfrm_= user xfrm_algo openafs(POE-) overlay cfg80211 binfmt_misc nls_iso8859_1 int= el_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency= _common isst_if_common skx_edac skx_edac_common nfit x86_pkg_temp_thermal i= ntel_powerclamp coretemp kvm_intel ipmi_ssif kvm cmdlinepart spi_nor irqbyp= ass mtd qaic(OE) mei_me rapl intel_cstate i2c_i801 mhi(OE) spi_intel_pci me= i switchtec(OE) ioatdma spi_intel i2c_smbus intel_pch_thermal dca ipmi_si a= cpi_power_meter acpi_ipmi ipmi_devintf ipmi_msghandler acpi_pad mac_hid sch= _fq_codel dm_multipath nfsd msr parport_pc auth_rpcgss nfs_acl lockd ppdev = grace lp parport sunrpc efi_pstore nfnetlink dmi_sysfs [1667258.914665] ip_tables x_tables autofs4 btrfs blake2b_generic xor raid= 6_pq libcrc32c dm_mirror dm_region_hash dm_log crct10dif_pclmul crc32_pclmu= l polyval_clmulni polyval_generic nvme ghash_clmulni_intel sha256_ssse3 bnx= t_en sha1_ssse3 nvme_core xhci_pci nvme_auth xhci_pci_renesas wmi aesni_int= el crypto_simd cryptd [1667258.914741] CR2: ffffb731b3fbcd40 [1667258.914746] ---[ end trace 0000000000000000 ]--- Thanks - Youssef