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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g3mkga3++RR-z4uHk2wAt6DYAi+h0rPAu4PurTugdkuQ@mail.gmail.com>
Date: Tue, 19 Dec 2023 20:57:01 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: chenguanxi11234@....com
Cc: rafael@...nel.org, len.brown@...el.com, pavel@....cz, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Chen Haonan <chen.haonan2@....com.cn>
Subject: Re: [PATCH linux-next v2] kernel/power: Use kmap_local_page() in snapshot.c

On Tue, Dec 19, 2023 at 2:19 PM <chenguanxi11234@....com> wrote:
>
> From: Chen Haonan <chen.haonan2@....com.cn>
>
> kmap_atomic() has been deprecated in favor of kmap_local_page().
>
> kmap_atomic() disables page-faults and preemption (the latter
> only for !PREEMPT_RT kernels).The code between the mapping and
> un-mapping in this patch does not depend on the above-mentioned
> side effects.So simply replaced kmap_atomic() with kmap_local_page().
>
> Signed-off-by: Chen Haonan <chen.haonan2@....com.cn>
> ---
>  kernel/power/snapshot.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index e3e8f1c6e75f..5c96ff067c64 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -1487,11 +1487,11 @@ static bool copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
>         s_page = pfn_to_page(src_pfn);
>         d_page = pfn_to_page(dst_pfn);
>         if (PageHighMem(s_page)) {
> -               src = kmap_atomic(s_page);
> -               dst = kmap_atomic(d_page);
> +               src = kmap_local_page(s_page);
> +               dst = kmap_local_page(d_page);
>                 zeros_only = do_copy_page(dst, src);
> -               kunmap_atomic(dst);
> -               kunmap_atomic(src);
> +               kunmap_local(dst);
> +               kunmap_local(src);
>         } else {
>                 if (PageHighMem(d_page)) {
>                         /*
> @@ -1499,9 +1499,9 @@ static bool copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
>                          * data modified by kmap_atomic()
>                          */
>                         zeros_only = safe_copy_page(buffer, s_page);
> -                       dst = kmap_atomic(d_page);
> +                       dst = kmap_local_page(d_page);
>                         copy_page(dst, buffer);
> -                       kunmap_atomic(dst);
> +                       kunmap_local(dst);
>                 } else {
>                         zeros_only = safe_copy_page(page_address(d_page), s_page);
>                 }
> --

Applied (under edited subject) as 6.8 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ