From: Jiri Slaby <jirislaby@kernel.org>
To: Qasim Ijaz <qasdev00@gmail.com>
Cc: jikos@kernel.org, bentiss@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] HID: multitouch: fix integer overflow in set_abs()
Date: Thu, 31 Jul 2025 09:43:38 +0200 [thread overview]
Message-ID: <f7257221-cbfa-4f51-8ac4-38060bfaf2f4@kernel.org> (raw)
In-Reply-To: <aIJXqs-U8vDpYv0S@gmail.com>
On 24. 07. 25, 17:56, Qasim Ijaz wrote:
> On Thu, Jul 24, 2025 at 08:58:40AM +0200, Jiri Slaby wrote:
>> On 23. 07. 25, 19:36, Qasim Ijaz wrote:
>>> It is possible for a malicious HID device to trigger a signed integer
>>> overflow (undefined behaviour) in set_abs() in the following expression
>>> by supplying bogus logical maximum and minimum values:
>>>
>>> int fuzz = snratio ? (fmax - fmin) / snratio : 0;
>>>
>>> For example, if the logical_maximum is INT_MAX and logical_minimum is -1
>>> then (fmax - fmin) resolves to INT_MAX + 1, which does not fit in a 32-bit
>>> signed int, so the subtraction overflows.
>>
>> The question is if it matters with -fwrapv?
>
> Ah yea thanks for bringing this up Jiri. I think you might be correct,
> after doing some research it looks like the kernel enables -fno‑strict‑overflow
> which implies -fwrapv which leads to wrap around instead of UB If I undestand
> correctly. So with that in mind this patch probably doesn't do anything
> useful, do you agree?
Yes, it correctly wraps around. But the question remains :). Does it
matter or not?
thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-07-31 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 17:36 [PATCH] HID: multitouch: fix integer overflow in set_abs() Qasim Ijaz
2025-07-24 6:58 ` Jiri Slaby
2025-07-24 15:56 ` Qasim Ijaz
2025-07-31 7:43 ` Jiri Slaby [this message]
2025-08-10 17:31 ` Qasim Ijaz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7257221-cbfa-4f51-8ac4-38060bfaf2f4@kernel.org \
--to=jirislaby@kernel.org \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qasdev00@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox