lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <796eecdb-f574-4eca-8cb7-ff426505435c@oracle.com>
Date: Fri, 19 Apr 2024 21:35:28 +0530
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Nam Cao <namcao@...utronix.de>
Cc: jayalk@...works.biz, Daniel Vetter <daniel@...ll.ch>, deller@....de,
        linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        tiwai@...e.de, bigeasy@...utronix.de, patrik.r.jakobsson@...il.com,
        LKML <linux-kernel@...r.kernel.org>,
        Vegard Nossum
 <vegard.nossum@...cle.com>,
        George Kennedy <george.kennedy@...cle.com>,
        Darren Kenny <darren.kenny@...cle.com>, chuansheng.liu@...el.com,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [bug-report] task info hung problem in fb_deferred_io_work()

Hi Nam,


+CC stable( heads up as this is a regression affecting 5.15.y and 
probably others, Greg: this was reproducible upstream so reported 
everything w.r.t upstream code but initially found on 5.15.y)

On 19/04/24 20:29, Nam Cao wrote:
> On 2024-04-18 Harshit Mogalapalli wrote:
>> While fuzzing 5.15.y kernel with Syzkaller, we noticed a INFO: task hung
>> bug in fb_deferred_io_work()
> 
> I think the problem is because of improper offset address calculation.
> The kernel calculate address offset with:
> 	offset = vmf->address - vmf->vma->vm_start
> 
> Now the problem is that your C program mmap the framebuffer at 2
> different offsets:
> 	mmap(ptr, 4096, PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0xff000);
> 	mmap(ptr, 4096, PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0);
> 
> but the kernel doesn't take these different offsets into account.
> So, 2 different pages are mistakenly recognized as the same page.
> 
> Can you try the following patch?

This patch works well against the reproducer, this simplified repro and 
the longer repro which syzkaller generated couldn't trigger any hang 
with the below patch applied.

Thanks,
Harshit
> 
> Best regards,
> Nam
> 
> diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
> index dae96c9f61cf..d5d6cd9e8b29 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -196,7 +196,8 @@ static vm_fault_t fb_deferred_io_track_page(struct fb_info *info, unsigned long
>    */
>   static vm_fault_t fb_deferred_io_page_mkwrite(struct fb_info *info, struct vm_fault *vmf)
>   {
> -	unsigned long offset = vmf->address - vmf->vma->vm_start;
> +	unsigned long offset = vmf->address - vmf->vma->vm_start
> +			+ (vmf->vma->vm_pgoff << PAGE_SHIFT);
>   	struct page *page = vmf->page;
>   
>   	file_update_time(vmf->vma->vm_file);
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ