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: <e9076da5-bd96-1a21-e4af-36eb46409178@linux.alibaba.com>
Date:   Thu, 15 Sep 2022 09:36:59 +0800
From:   Shuai Xue <xueshuai@...ux.alibaba.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     naoya.horiguchi@....com, linmiaohe@...wei.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, cuibixuan@...ux.alibaba.com,
        baolin.wang@...ux.alibaba.com, zhuo.song@...ux.alibaba.com,
        Huang Ying <ying.huang@...el.com>
Subject: Re: [PATCH] mm,hwpoison: check mm when killing accessing process



在 2022/9/15 AM6:35, Andrew Morton 写道:
> On Wed, 14 Sep 2022 14:49:35 +0800 Shuai Xue <xueshuai@...ux.alibaba.com> wrote:
> 
>> The GHES code calls memory_failure_queue() from IRQ context to queue work
>> into workqueue and schedule it on the current CPU. Then the work is
>> processed in memory_failure_work_func() by kworker and calls
>> memory_failure().
>>
>> When a page is already poisoned, commit a3f5d80ea401 ("mm,hwpoison: send
>> SIGBUS with error virutal address") make memory_failure() call
>> kill_accessing_process() that:
>>
>>     - holds mmap locking of current->mm
>>     - does pagetable walk to find the error virtual address
>>     - and sends SIGBUS to the current process with error info.
>>
>> However, the mm of kworker is not valid. Therefore, check mm when killing
>> accessing process.
> 
> Thanks.
> 
> When fixing a bug, please always describe the user-visible effects of
> tha bug.  I'm thinking "null pointer deref crashes the kernel".

Got it. Thank you :)

> 
>> Fixes: a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address")
>> Signed-off-by: Shuai Xue <xueshuai@...ux.alibaba.com>
> 
> I'll add cc:stable.

Thanks.

> 
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -743,6 +743,9 @@ static int kill_accessing_process(struct task_struct *p, unsigned long pfn,
>>  	};
>>  	priv.tk.tsk = p;
>>  
>> +	if (!p->mm)
>> +		return -EFAULT;
>> +
>>  	mmap_read_lock(p->mm);
>>  	ret = walk_page_range(p->mm, 0, TASK_SIZE, &hwp_walk_ops,
>>  			      (void *)&priv);
>> @@ -751,6 +754,7 @@ static int kill_accessing_process(struct task_struct *p, unsigned long pfn,
>>  	else
>>  		ret = 0;
>>  	mmap_read_unlock(p->mm);
>> +
>>  	return ret > 0 ? -EHWPOISON : -EFAULT;
>>  }
> 
> This is an unrelated change which doesn't appear to match the style in
> memory-failure.c, so I'll drop this hunk.

I see, thanks.

Cheers,
Shuai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ