From nobody Sat Apr 4 00:14:00 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 D9826F9E8 for ; Sun, 22 Mar 2026 11:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774177834; cv=none; b=UGZCV8h6Y+BilPPm9xYMqRxrwgwu0+/XbeQ4MH/8iZllh2xfJIN6Hr8cKh6AV1LwU3slvKebH94bPbSoURjNhWzDGQF8VG6dXmUOxcNR2KlH51CpNGso4dvf9ieuWo+mJ770oNgejL4u+4rK7TJpTmcq3CnirFiL4wpuuAR4VWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774177834; c=relaxed/simple; bh=NLIEw1ZR7mTPpeFnQNrEtJKL+JrWXPexTzwN4Rbrlp8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Dcdv21pTvppTfMpSmRIiQWdK+KK5tcoXPv5L4R9e7HGP+usbdtOBF+nwg0ii+Qx9IQ0R0tKNHBskXYcjKmOvyh0FmWBsAxlKsVQrXqObo/pLM7bk+x0cweUkEh1zMtWhDFTmZvFCpSYA+FsJg9BWaC+BgmjmP7xpBNDdWheIC1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Bg48Iizk; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=CPn9v9Qz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bg48Iizk"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="CPn9v9Qz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774177832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pD6rEELAAr02II5508NHP6GW7PMLu9br7i436TBlft0=; b=Bg48IizkNtcO1N/jMJNTV1D3XT4sVVu6grEvS0OhhKTrqCI2nb7Cq+KHopz+QBZ8CGY/a+ MBySdybcdalUhOMrbHAzndFOBmG4hEVUwue4dcpWbDzXwdsvMvZZtIWzrRvls9Z0n6C0O5 RcIDSz8tirLCkxJ7c68r/2Wi/SugMJ4= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-8SQd9-1TMlu59DH12HoFqg-1; Sun, 22 Mar 2026 07:10:30 -0400 X-MC-Unique: 8SQd9-1TMlu59DH12HoFqg-1 X-Mimecast-MFC-AGG-ID: 8SQd9-1TMlu59DH12HoFqg_1774177829 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-35b93be1227so2351870a91.0 for ; Sun, 22 Mar 2026 04:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774177829; x=1774782629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pD6rEELAAr02II5508NHP6GW7PMLu9br7i436TBlft0=; b=CPn9v9Qzx2MheDZQArmzhU5/2IbSYDCrWjTNyr/GBm3/8JoXnkcunbl5fPgUHE1taI ixOve1di3ytX3w5gB03TicDjgkAh6ySZWy3EPJTiyN+gXeipHqNGlnBwKKZNnTe7Z8xp eetGree4JlP2lIdVYctN2avFWsBCn6csH4T9HwadbkqwBnNKTe3d479/MAXTWNpwIT8c moF7C1iNS0XjeA96Dik8lDNGzFw1CvHv5n5qlQ7aYUBKFrBf/6ARKiVy1ypydflidRwM owcevKDIRSzK5+wwU6VkTcDKDGk+C6ge9Oewj5bnKHyczvjiGvYoNRNCLdWtpcuz2OGb ju4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774177829; x=1774782629; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pD6rEELAAr02II5508NHP6GW7PMLu9br7i436TBlft0=; b=O3nmI7Ev+E6LUcCI9IT8zYeaLqtRtWLL5wTzVOgWlZJHZvNXxPj2diL2gcwW/+Mvkr Z2y4uX5WgRJaxpmsk3ntcQF5Ls9F3REN/zj+6EoRLG7u2diw526JMmJmJ55QdABrkbu/ 7zXzMNSOVl+pfkhRVBi6NUGAuh1fRR1zDOiElnVFJFYMJ3Xe7L8VGmRejcwW5LODx1Am SUWaUC+B4zyTbVsbuCnTPDzJ+1M7awZoKEm7/eRN9juAnwPDNyaFQG6qL//HqxdjRjps 0mcXdzxbxcLYDHR8AzItKb8MINmMJ3nsk1OEwG3MIHdD9jcb2W6Se3pY7ozl10VIR4oF AIfg== X-Forwarded-Encrypted: i=1; AJvYcCV7Cw1+W1LjjCP15ZswdjGz2Kd3CosjXIABM+vMTeXATj4p3yu2kFFsIINlp9fetrdyUVQvSm5EgIhLjms=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1JGFX/JU4PBIMPjsQsKYj/HzPOLRWMd4+Ib4YJP13DqIvXdDx UwCLGisI6wf9j70vrFBVcl4HxWSdqGi4jqFB8JqFHjiQuWgeuuMqx5puIxnVROBsvKsH0+tXVo3 QEYJGYOw6dhKc5Q2nBq4lvXtWgI7CZZDcYGfwuhQFENPNPD5+tdbYGFcq9lTqZ8CryA== X-Gm-Gg: ATEYQzwU0NZ36AlhgKZEhKxbpzzypShKZaj/l1LXjiOk1E9Ju5RipO75sEC4mRqny45 0R5uV09c3N64Fl5n2DLbqVBnk1f/1UkzEE8L4+wVTV2sJgpUbzkQk/tO+ZqCNJR9vBkFa2y3DFF TsfcMEdiMfMZR08KjmRnEdb7B3rZxhn7/uVwG1ZZ536nxAGIJ+SwPD8Dypv0DvT6cND7v7Hzdr4 VeFWIjcIu0TiAyZEeD91EYLE8fAtQ0iJi93PKJB/NLl+YZjtyws4OxN0YXBMDN8PU4SsMLgnNCZ eSGDwxqftTwMZmLtdrHX0RuOQ7hIE7tpsbzC3uB5ob5WwmFcw9sSdixWNgrFrNVn1ChCZXp8gNd lm2+Okkee+kyVM6pxX+M+vWXRj4Rw/tMMuN572y16Hgu7Uw== X-Received: by 2002:a05:6300:8b0f:b0:398:981e:2e13 with SMTP id adf61e73a8af0-39bcec310bdmr7945009637.62.1774177829503; Sun, 22 Mar 2026 04:10:29 -0700 (PDT) X-Received: by 2002:a05:6300:8b0f:b0:398:981e:2e13 with SMTP id adf61e73a8af0-39bcec310bdmr7944993637.62.1774177829069; Sun, 22 Mar 2026 04:10:29 -0700 (PDT) Received: from kernel-devel.tail62cea.ts.net ([240d:1a:c0d:9f00:be24:11ff:fe35:71b3]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c743a801b79sm5277794a12.3.2026.03.22.04.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2026 04:10:28 -0700 (PDT) From: Shigeru Yoshida To: Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , Paul Moore , James Morris , "Serge E. Hallyn" Cc: Shigeru Yoshida , syzbot+6ed94e81a1492fe1d512@syzkaller.appspotmail.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ima: abort file hash computation on fatal signal Date: Sun, 22 Mar 2026 20:10:19 +0900 Message-ID: <20260322111019.2815601-1-syoshida@redhat.com> X-Mailer: git-send-email 2.52.0 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 Content-Type: text/plain; charset="utf-8" ima_calc_file_hash_atfm() and ima_calc_file_hash_tfm() compute a hash over the entire file contents without checking for pending fatal signals. When a very large file is being hashed during mmap (via ima_file_mmap), the computation can take an extended period. If a coredump is initiated by another thread in the same thread group during this time, the dumper thread waits in coredump_wait() for all other threads to exit. However, the hashing thread cannot exit until the hash loop completes, resulting in a hung task. Add fatal_signal_pending() checks to both the ahash and shash file hashing loops so that the computation is aborted promptly when SIGKILL is received. Fixes: 3323eec921ef ("integrity: IMA as an integrity service provider") Reported-by: syzbot+6ed94e81a1492fe1d512@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D6ed94e81a1492fe1d512 Tested-by: syzbot+6ed94e81a1492fe1d512@syzkaller.appspotmail.com Signed-off-by: Shigeru Yoshida --- security/integrity/ima/ima_crypto.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/i= ma_crypto.c index aff61643415d..7b721b9c944f 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include =20 @@ -416,6 +417,12 @@ static int ima_calc_file_hash_atfm(struct file *file, =20 if (rbuf[1]) active =3D !active; /* swap buffers, if we use two */ + + if (fatal_signal_pending(current)) { + ahash_wait(ahash_rc, &wait); + rc =3D -EINTR; + goto out3; + } } /* wait for the last update request to complete */ rc =3D ahash_wait(ahash_rc, &wait); @@ -491,6 +498,10 @@ static int ima_calc_file_hash_tfm(struct file *file, rc =3D crypto_shash_update(shash, rbuf, rbuf_len); if (rc) break; + if (fatal_signal_pending(current)) { + rc =3D -EINTR; + break; + } } kfree(rbuf); out: --=20 2.52.0