From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp66.iad3b.emailsrvr.com (smtp66.iad3b.emailsrvr.com [146.20.161.66]) (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 ED7332CCC0 for ; Wed, 3 Dec 2025 13:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=146.20.161.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764769622; cv=none; b=MVqPu06dxPUSpGoCOv/Z1rmSUACJMbWCv1ReizBy6F0YDdv2XM6duixiOu83u+rrXpa3vEdrT5MXnqDp8oJw4hUER825G6u4S8dSfErIiFZb4NMLfYqSTUsD2y/Cp8mYrbPG4xv+EPhaiZ3uRwnm0nsUbd9t68Rk45f4OIv+ieU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764769622; c=relaxed/simple; bh=sJW0ibv0Bhjaj7cz2HbdlmkrKYIefwoUnUTz8PmvsJ4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G7V1R6wdcTIgx0Lilp03n8JEtDAwIUcfTu7gV1pv4ihfjMIbCNesA6V4Wx4YkVdULU66vsJ2fF0vPrmDj8lSBkrag0H+KgKLLd2gQ7VmwaHIdBpRD6Fechwvj4OFcghT2TJi5dVz8T6eMxr4f23VEDwpsQvMFoqAUqGTnF49/3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk; spf=pass smtp.mailfrom=mev.co.uk; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b=y6XE2irX; arc=none smtp.client-ip=146.20.161.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b="y6XE2irX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1764767289; bh=sJW0ibv0Bhjaj7cz2HbdlmkrKYIefwoUnUTz8PmvsJ4=; h=Date:Subject:To:From:From; b=y6XE2irXkzdHXCGSlum0isdvFs1i7AnU/CGH3EpyEPQVlXnmDYeWoJ5RnFS/rbzpc X3yyiZBWMhYlWp6JU1tvzIT3YEcblNtqfIfkeSvu9JPSzXErUEpytCSvqGBXcSQlI5 WHLkqfnNADN+qfLXQqvFLyiiB60EcyNYjmcn7AzE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp17.relay.iad3b.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 6808EA03B1; Wed, 3 Dec 2025 08:08:08 -0500 (EST) Message-ID: <22bbe97e-db08-481b-96d0-eb1d12227083@mev.co.uk> Date: Wed, 3 Dec 2025 13:08:06 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [BUG] Drivers/8255: Page fault in comedi_8255.c To: =?UTF-8?B?5p2O5aSp5a6H?= <2200013188@stu.pku.edu.cn>, linux-kernel Cc: hsweeten , xujiakai2025 , "zhaoruilin22@mails.ucas.ac.cn" References: Content-Language: en-GB From: Ian Abbott Organization: MEV Ltd. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Classification-ID: 5c4320f4-f734-43f4-aed0-9ab649406eb1-1-1 On 29/11/2025 13:19, 李天宇 wrote: > Hi, > > There’s a bug in the comedi_8255.c file, specifically related to a page fault. This issue occurs when an illegal address is passed as a parameter to outb() function at line 47. This illegal address is subsequently used in asm code, leading to a page fault when trying to write to -0x70(%rsi). > > The bug was initially discovered via a fuzzing framework on Linux kernel version 6.18-rc6, and it was later found reproducible on Linux kernel version 6.18-rc7. > > After analyzing the calling stack, I suspect that the root cause may lie in the dev_8255_attach function. Specifically, at 8255.c:70, when reading iobase from it->options[i], there seems to be no validation for the conversion from int to unsigned long. If a negative value is encountered, it is cast to an illegally large number (e.g., 0xffff…), which may be causing the issue. There is validation by request_region(), which is the reason for the reported I/O port conflicts. Admittedly, the 8255 driver should probably reject any specified I/O port addresses that are not aligned on 4 byte boundaries to match the register decoding of the 8255 chip, but I don't think that's the problem here. > > I’m not entirely confident in this analysis, but fortunately, there’s enough information provided for your reference: > > Kernel Source: https://git.kernel.org/torvalds/t/linux-6.18-rc7.tar.gz > Configuration: https://github.com/j1akai/KConfigFuzz_bug/raw/refs/heads/main/x86/mainline-config > Reproducible Code: https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/405536bde2d1b503f3903a2a3de2d6dd94cef0a3/repro.cprog > GCC Info: https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/405536bde2d1b503f3903a2a3de2d6dd94cef0a3/gccinfo > Kernel Log(First found): https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/405536bde2d1b503f3903a2a3de2d6dd94cef0a3/report0 > Kernel Log(Later Repro): https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/405536bde2d1b503f3903a2a3de2d6dd94cef0a3/report > > I hope this information is helpful in identifying and resolving the issue. Thanks for your time and attention. > Looking at the list of I/O base addresses that "repro.c" is using and the I/O port conflict messages in the "Later Repro" report, it seems happy enough until it tries to set up an 8255 subdevice at I/O port base address 0x100. I don't know if there is any actual (or virtual) hardware at that base address that may be causing problems. Historically, IBM PS/2 systems had a set of Programmable Option Select registers at that address. -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-