From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41FA91F4611 for ; Sun, 12 Jul 2026 01:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783820719; cv=none; b=T6lgrHn+vLZlfVD7LUs2AjS5SHoG9MwgpQ+/NGW2THjvjaTHNT+/zqPZtviFC3sUQv5iC5R45BTOo1ROCzeK3uqjyEEe681bwiSrx4azCoE9bgEYmYzGOzTJVYgR5HnEiQfQMSWWW5s/z0+ngB+cbo+yJyewRl+EoRo5unlKtZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783820719; c=relaxed/simple; bh=SiXG3Vl6tdyaZKcYbxpybRYANDdC5zL6iyKWoX1ZfWM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lS3fZVa+3Mz0nSNxHXztFW2H1iSw1HLRNkN5fK9EhXbIlZ3h3FpbnxObFXVVfR3GHiKgplQ5REiNPoOMuMxYfU1zr7g5nxNmhijmDLZLKbtUzS9keRyJqYx2oGVaAtMOLWg2DE+4dB1WXLeu3aIMOgT/1zNsH0YUJrB3qn8QeCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X5aRUcCR; arc=none smtp.client-ip=209.85.222.175 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.b="X5aRUcCR" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-92e57a753f9so167325585a.2 for ; Sat, 11 Jul 2026 18:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783820717; x=1784425517; 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:content-type; bh=uW6fI+83ucGhBzlzhMQZhfNKo2rTn+HYkdwfVzxP5Vg=; b=X5aRUcCRnLVnkImg0aEXL20czK6e+vtn6l9f57H0Gun8KWUxU68QOZeEpIWkMLPwcf vbgpHXFBsjumJZaQ3tCaQDSHB1NIAYl6vLaXhPt1GCTVHJdNO7wsx7ip5qubZ5U8i3F4 hEylView1ohjgn3l8TKfTdZPtUpUWdpzdyosJ93W83v41p/P1zel6gdkVW46HB43u00j Z0Ycq1c1yR/Zfb7SEWQppSbF3jPRT369zNjTHVrbhUOhW4vyVxM6vbJ8ZRjSQ2Cdl1xV fm6jMG3RMgg7tQwvWOVoaBVVYxSfIEqAx5j+rntIxg+2E2t8tCHUygWm+wJuBHNqW0iH OVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783820717; x=1784425517; 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:content-type; bh=uW6fI+83ucGhBzlzhMQZhfNKo2rTn+HYkdwfVzxP5Vg=; b=bNaQzsNbHo08IAHf9ulqEJzqWxdb5ZAIZ7YmOer5edS6Pv6qCJ4opltM3C3DsIm+Qg t196TuyPAaWQcBrnSCRScAyacXqLzUSv0TGJB1hQKsnOK9+MTBMLqDQnvshwPaSPh8rl qIWdEjpqR8gEqkv8Ppe2QWm4Uc634wNgClz6yRSu+YPl6wESNmQGrrObf9sRxAza1X7s WC3QfsvUEhNGym4xD0SkgvN20OFYJEgoz9nSPNcvb9d9LbyOWBHPRHpImUN9siBEy6vI MZJq6spt6D/AGt7lu5wsXQ+WYpv1ixu8NuMSPIY61rGBR03m2mSr+8nq5ZrdLh5mpUHE KUeA== X-Forwarded-Encrypted: i=1; AHgh+Rq+TIvsh9QW6uCCHQ9rg7sFT7CWyG8yx8hj1LzaQs4lI8JHFhhycLM3A+29myw5yFF2wVbgSztITMu717I=@vger.kernel.org X-Gm-Message-State: AOJu0YxHJnowQj9e0c/0wW+LxJ37ShqCW0cx+GZs0bYlOnjoSiH5xuT5 hmQhvIklQc3slNscpdSNBuwqpWou3lzMM5M16mSYi0twfA/Z6/B2sYHM X-Gm-Gg: AfdE7cmuYBFq5Sjt/pV2p0Z/NqoUgCoxgXz0OMF7OBrgzj6sOK8O+MeterKY8fj7dEh QrPCUgzBJaFKg+X4tI7kVYrzBUMupVd3Zhk6Ubaun2dVNdqH+n39BTT5GPdIMmBABX3BTSMYATU mwNZzRPrV7pNRqBIsnkEs70vFecvCVlDB6hTr6UyQSuNjdxuOrte6pInpenfFDYym/tcfepNlBD JK1C8L4RTV9li3D6Ct8OZd1e0nClQlGELc913PsC6bS4NXOljSUqro7+6xNeRymVn0dWNlJ1mdQ 1eihEPOznBtxs9ch1tCMr94UslgtFzuTW92gzAActT1OMKxiAZYnrBMNk1AYor+KOqNcG/i7Eao cFNs0EY6JWFeSPcCF94+JRUCOvZEInIE6y9jtVRAf1cDtuWj0cYjV5KSrTdEYSqr5U3QW8ZklIy uIKh0yhwkFtCqN7XsonN0RUzUfC2nhQAI6tqYpB4Gck7zeAugeqh9Qrxa3jehvVkTjeNSRiO0O4 fZDJucSsw== X-Received: by 2002:a05:620a:2a07:b0:92e:70a4:2c5b with SMTP id af79cd13be357-92ef2d00d41mr475600985a.69.1783820717092; Sat, 11 Jul 2026 18:45:17 -0700 (PDT) Received: from server0 (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee5b492ebsm624902185a.9.2026.07.11.18.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2026 18:45:16 -0700 (PDT) From: Michael Bommarito To: David Howells , Jarkko Sakkinen Cc: Paul Moore , James Morris , "Serge E . Hallyn" , Andrew Morton , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] keys: fix keyring assoc-array out-of-bounds read and index inconsistency Date: Sat, 11 Jul 2026 21:44:57 -0400 Message-ID: <20260712014500.480410-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit keyring_get_key_chunk() advances the description read pointer by level * sizeof(long) past the inline prefix but only bounds-checks the prefix, so once the associative-array walk reaches a description-level chunk it reads past the kmemdup(desc, desc_len + 1) description allocation. Reaching that depth needs two keys that collide through the hash, x, type and domain_tag chunks, which an unprivileged add_key(2) can arrange with a crafted pair of same-type keys. An unprivileged user can thus read up to sizeof(long) bytes past a keyring key's description; on kernels built without init-on-alloc the same collision, read back with KEYCTL_READ, returns uninitialized kernel slab. Patch 1 is the memory-safety fix and stands alone. Patches 2 and 3 fix two index-key consistency bugs that let the crafted keys collide into a single malformed node in the first place, which is what enables the KEYCTL_READ disclosure. The KASAN reproduction is on patch 1. Trigger is available off-list. Michael Bommarito (3): keys: fix out-of-bounds read in keyring_get_key_chunk() keys: make keyring key-chunk byte order agree with keyring_diff_objects() assoc_array: trim the final shortcut word when skip_to_level is chunk-aligned lib/assoc_array.c | 2 +- security/keys/keyring.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) base-commit: 2c7c88a412aa6d09cd04b414211b4ef8553b5309 -- 2.53.0