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 X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0408C433E1 for ; Thu, 27 Aug 2020 21:01:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 731B320872 for ; Thu, 27 Aug 2020 21:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598562085; bh=jjkcxKZ6dNsY8PM9iTN/MLtcVaCpYdrNjBalpQn0QKw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=mHkN+61zyo9eNq/iV5slbtUMg9UEi3ndd6lcrRiH/uGbjXzI4VlN4FrzhcorrhQzP 8iJ/PbKO2PGkSUvURzGpGpiNp8TRx3KWMc95my9pxRpvN4cb0qmPSgh5gg8amZizTV CqGm1SNuHjcksI6rJbWM7ahwt9qzqWUKGVj/Z9R0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726147AbgH0VBY (ORCPT ); Thu, 27 Aug 2020 17:01:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:41808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0VBY (ORCPT ); Thu, 27 Aug 2020 17:01:24 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EBF5207F7; Thu, 27 Aug 2020 21:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598562083; bh=jjkcxKZ6dNsY8PM9iTN/MLtcVaCpYdrNjBalpQn0QKw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pK8q81XISaSFBpd8q69p3apIHwvSziYxNZ3IDq/NsXPSa/6N8YmfvfFMFfgdDQAwL zcbAA+yjuPJP+eORQN9EtwlTCp0m0wR4RoqCew/FPhZy528GPNvjf8hmjDi6lCmKxh tK80lSUYwW0JHZxRzCvvQI3hscibU/Ghykpv6rTo= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kBP1N-007FTK-Ib; Thu, 27 Aug 2020 22:01:21 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 27 Aug 2020 22:01:21 +0100 From: Marc Zyngier To: Jiri Kosina Cc: Benjamin Tissoires , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] HID: core: Sanitize event code and type when mapping input In-Reply-To: References: <20200826134658.1046338-1-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <2a6d7269c30de10c22580d002af9c1a3@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On 2020-08-27 10:33, Jiri Kosina wrote: > On Wed, 26 Aug 2020, Marc Zyngier wrote: > >> When calling into hid_map_usage(), the passed event code is >> blindly stored as is, even if it doesn't fit in the associated bitmap. >> >> This event code can come from a variety of sources, including devices >> masquerading as input devices, only a bit more "programmable". >> >> Instead of taking the event code at face value, check that it actually >> fits the corresponding bitmap, and if it doesn't: >> - spit out a warning so that we know which device is acting up >> - NULLify the bitmap pointer so that we catch unexpected uses >> >> Code paths that can make use of untrusted inputs can now check >> that the mapping was indeed correct and bail out if not. >> >> Cc: stable@vger.kernel.org >> Signed-off-by: Marc Zyngier >> --- >> * From v1: >> - Dropped the input.c changes, and turned hid_map_usage() into >> the validation primitive. >> - Handle mapping failures in hidinput_configure_usage() and >> mt_touch_input_mapping() (on top of hid_map_usage_clear() which >> was already handled) > > Benjamin, could you please run this through your regression testing > machinery? > > It's a non-trivial core change, at the same time I'd like not to > postpone > it for 5.10 due to its nature. I found yet another nit that this patch doesn't quite catch. v3 going out in a minute. Thanks, M. -- Jazz is not dead. It just smells funny...