From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (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 29AD824A05D for ; Fri, 26 Jun 2026 00:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782434831; cv=none; b=iWaB6/UAzegigj0Zn6RzhqhxQTvpq5W0hUMmcJ8Gcx0crrB+rhNRw/dF6HoQPQJXp8I7qS5hYJILanRitC+lwm+T7m5QqbMTWI4HrQzCMVem+5dX+hWZxnE1IphXO7AUNZGU00mCBBgnWq62B7kXpVsnE/1Kvk8rAeIyIl2Qk+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782434831; c=relaxed/simple; bh=6yrkd+f6Od2f0s6kOTu9gBsVj1K7M8+rMQ/nmU9kYuE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MDs7c9Hl4gCwX7n2K5KjGKGJ1CU1bKTnSnR0QUHkuSsYDLFYFRzlM0Jv1MgKKUaFVAyf9qJvvTpwHGTvcmUvQQ8pm+pjvu/Fw0ai2AnA6V/Wx9juBcFwHTzpKg7qmVghtXQRPn+bgmTxGa33229gId9m0GBTr1LbGZnl1PQOEvE= 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=l6YYhv4K; arc=none smtp.client-ip=74.125.82.50 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="l6YYhv4K" Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-1384ebe7a10so1081176c88.1 for ; Thu, 25 Jun 2026 17:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782434829; x=1783039629; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=iAkgYZFIckmLQ72JHdZDQUywabEfED+EFNSDTArDkJw=; b=l6YYhv4Kzq+C7LajfngWTQAcU3HeDExKpEhE9OdhtG4BJXAWyW0hBl0t1dSTLJGhZr ZAe+BkohaSw1psy21Dhq0btblOFnbDA5to0XuN1uXID3VDYPuBaHWBAPM4wtBw9S+6/m c4pjH5+q49qcfYTetnHpZ3pLFVJs4AsNQ2ZljDxXLu2UH2f1Tb+xI6X7M7MqsUwERADF qULPrWLaEQsH9rqoy3Jv1OefkmryQnRVpdOxRCgCbbJ/OlnSOxnaa18iJedzqASZyEyt aq00OrF6Fapk6GmYkG/leAI8At6Om6D8GsHakjp4Mcgyz6bjwyUIYZck0W4zHlGyIxYI TYtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782434829; x=1783039629; h=in-reply-to:content-disposition: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; bh=iAkgYZFIckmLQ72JHdZDQUywabEfED+EFNSDTArDkJw=; b=tE3Lall35iocSFkHE+xIGAi6LxnRNLsAN/Vc6XF8N+b6tzIiIm7dii8N/7SnH0MJi9 Bx32OYJOqNyNJ5q+jAPRt/yGDFKhURv0PRI6EOybEnHxW3Nq8vvSQCqdhevbQmN0zVCY aTUTD5Zs4eF3Zm7FBN2KKwCFPijBFmC2CezfW8IwcZq3CtH7nzKWdSquiBm87suYyR36 z3zogFafBUl+91pINAanTQCt+l8gncUNvoyLR3vXCbGNaHnsJfCyMMknMqB9AL9aX4mP VeYCOGbACRxrGHR2p2/y+YQPKD+Ucgknr+5vZQOzU0H1Epxs/mRLvFo8Jp+zod9EmHHq mOqw== X-Gm-Message-State: AOJu0Yz4eygf3zjC24ZhJAmn7yp/cNdP2jNrKG5pN3tQHbj8ciYP9EJa KTg1HQsvjjItIg3Ne0nl/gxXmlepxj8fV8ykFZav73WoX7EhPjdx2HnA X-Gm-Gg: AfdE7clPxFk8vKeQBVZaJKo3L7IWQUR5Uzd8gjxM0Rs61IfdzzZC5lP3X66ydzKlk5k wWXGGiibu41WZVw16BvP/3q2V7ekGKTL1LzX885eJawI+pHTIFQLhjHUD8ZEjR+zPd0Gf9yDeyc 4ty4hg4sjHr+efoSKs1qScjOIVeACDEU24JFR8uiLf+1pgFwtXIatEvxCGTjg+jkRFjDyHKe+3B 6SEiGKiaAwND5hJv+Ao7GvDbx2FWxtZCOGkZrw33xN0238+B2378EKdRteGlO56GIJPwxXDCDWm wisrA+2lWlSLUQH7fE9AywzyV+PmbnxE3/TiKb6jVCHMlZRYjIg1Eodwjv4XN/EKVDIR7XF476a 4JyKcmotJjRj/MVFbQlw5JjNZQxP0GV02yHTRVJwuigCzbrTAaIJIbqrcvtH7vYOGjEH45FUSNh xEZtfDNCWsdT99OUIVVlT5Eox5NVtcx4JjKzzutLhTHB7/mh8VpK+u0w== X-Received: by 2002:a05:7023:a4b:10b0:139:dd81:70bb with SMTP id a92af1059eb24-139dd8195efmr2446115c88.30.1782434829133; Thu, 25 Jun 2026 17:47:09 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:a474:bf4a:4966:8d97]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-139d912197bsm19501767c88.15.2026.06.25.17.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2026 17:47:08 -0700 (PDT) Date: Thu, 25 Jun 2026 17:47:05 -0700 From: Dmitry Torokhov To: hexlabsecurity@proton.me Cc: linux-kernel@vger.kernel.org, Hans de Goede , Vincent Huang , linux-input@vger.kernel.org, Andrew Duggan Subject: Re: [PATCH 0/2] (no cover subject) Message-ID: References: <20260614-b4-disp-818d6bda-v1-0-cf39a3615085@proton.me> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260614-b4-disp-818d6bda-v1-0-cf39a3615085@proton.me> On Sun, Jun 14, 2026 at 12:36:10AM -0500, Bryam Vargas via B4 Relay wrote: > From be2c4843f6145374f28edd25cef43c9373542874 Mon Sep 17 00:00:00 2001 > Message-ID: > From: Bryam Vargas > Date: Sun, 14 Jun 2026 00:30:09 -0500 > Subject: [PATCH 0/2] Input: synaptics-rmi4 - fix out-of-bounds keymap access on large GPIO counts > > The RMI4 F3A and F30 function handlers size their GPIO/LED key map to > min(device_gpio_count, TRACKSTICK_RANGE_END) == at most 6 entries, but > then consume that map with the full, unclamped device-reported count in > two places: the attention-interrupt report loop, and input->keycodemax > (while input->keycode points at the small allocation). > > A device that reports a GPIO/LED count greater than 6 therefore yields a > key map of at most 12 bytes that is indexed up to count-1: > > - rmi_f3a_attention() / rmi_f30_attention() read gpio[led]_key_map[i] > out of bounds on every attention interrupt (device-triggered), and > > - the input core's default keymap ioctls bound the index only against > keycodemax, so EVIOCGKEYCODE reads adjacent slab memory back to user > space and EVIOCSKEYCODE writes a caller-controlled u16 past the > allocation -- a controlled out-of-bounds heap write reachable by any > process that can open the evdev node. > > Both handlers have the same shape; F3A was copied from F30. Patch 1 fixes > F3A, patch 2 fixes F30. The one-line fix in each sizes the key map to the > full device count; the mapping loop is unchanged (it still populates only > the first min(count, 6) entries, the rest stay KEY_RESERVED and are > skipped on report), and keycodemax now matches the allocation, closing > the interrupt and both ioctl paths. > > Reproduced with KASAN on a faithful in-kernel model of each handler > (kmalloc-16 bucket, 12-byte request, reported count = 127): > > # without the patch -- attention read path > BUG: KASAN: slab-out-of-bounds in rmi_f3a_attention > Read of size 2 ... 0 bytes to the right of allocated 12-byte region > ... cache kmalloc-16 > > # without the patch -- EVIOCSKEYCODE write path > BUG: KASAN: slab-out-of-bounds ... > Write of size 2 ... 0 bytes to the right of allocated 12-byte region > > # with the patch (key map sized to the full count): clean > # benign device (reported count <= 6): clean > > The full read and write splats and a 32/64-bit ASan model of the same > geometry are available on request. Applied the lot, thank you. -- Dmitry