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: <7dac9afa-9778-187d-8f69-53a7e92bbe97@huawei.com>
Date: Tue, 18 Feb 2025 10:53:51 +0800
From: Tong Tiangen <tongtiangen@...wei.com>
To: Oleg Nesterov <oleg@...hat.com>, Andrew Morton
	<akpm@...ux-foundation.org>, Peter Xu <peterx@...hat.com>, David Hildenbrand
	<david@...hat.com>
CC: Masami Hiramatsu <mhiramat@...nel.org>, Peter Zijlstra
	<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de
 Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, Mark Rutland
	<mark.rutland@....com>, Alexander Shishkin
	<alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, Ian
 Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, "Liang,
 Kan" <kan.liang@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
	<linux-trace-kernel@...r.kernel.org>, <linux-perf-users@...r.kernel.org>,
	<bpf@...r.kernel.org>, <wangkefeng.wang@...wei.com>, linux-mm
	<linux-mm@...ck.org>
Subject: Re: [PATCH -next] uprobes: fix two zero old_folio bugs in
 __replace_page()



在 2025/2/18 0:12, Oleg Nesterov 写道:
> Can't comment, my understanding of mm/ is not enough these days.
> 
> Just one question...
> 
> On 02/17, Tong Tiangen wrote:
>>
>> Fixes: 7396fa818d62 ("uprobes/core: Make background page replacement logic account for rss_stat counters")
>> Fixes: 2b1444983508 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
> 
> Are you sure this logic was wrong from the very beginning? Just curious.
> 
> Oleg.

Yes, i checked the original code logic, and the put_page() didn't take 
zero pages into account.

Add Morton,Peter and David for discussion.

Thanks,
Tong.

> 
>> Signed-off-by: Tong Tiangen <tongtiangen@...wei.com>
>> ---
>>   kernel/events/uprobes.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
>> index 46ddf3a2334d..ff5694acfa68 100644
>> --- a/kernel/events/uprobes.c
>> +++ b/kernel/events/uprobes.c
>> @@ -213,7 +213,8 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
>>   		dec_mm_counter(mm, MM_ANONPAGES);
>>   
>>   	if (!folio_test_anon(old_folio)) {
>> -		dec_mm_counter(mm, mm_counter_file(old_folio));
>> +		if (!is_zero_folio(old_folio))
>> +			dec_mm_counter(mm, mm_counter_file(old_folio));
>>   		inc_mm_counter(mm, MM_ANONPAGES);
>>   	}
>>   
>> @@ -227,7 +228,8 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
>>   	if (!folio_mapped(old_folio))
>>   		folio_free_swap(old_folio);
>>   	page_vma_mapped_walk_done(&pvmw);
>> -	folio_put(old_folio);
>> +	if (!is_zero_folio(old_folio))
>> +		folio_put(old_folio);
>>   
>>   	err = 0;
>>    unlock:
>> -- 
>> 2.25.1
>>
> 
> 
> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ