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: <YMu790ZvgzYWrJXV@yury-ThinkPad>
Date:   Thu, 17 Jun 2021 14:17:43 -0700
From:   Yury Norov <yury.norov@...il.com>
To:     Barry Song <song.bao.hua@...ilicon.com>
Cc:     gregkh@...uxfoundation.org, andriy.shevchenko@...ux.intel.com,
        linux-kernel@...r.kernel.org, linux@...musvillemoes.dk,
        rafael@...nel.org, akpm@...ux-foundation.org,
        rdunlap@...radead.org, agordeev@...ux.ibm.com, sbrivio@...hat.com,
        jianpeng.ma@...el.com, valentin.schneider@....com,
        peterz@...radead.org, bristot@...hat.com, guodong.xu@...aro.org,
        tangchengchang@...wei.com, prime.zeng@...ilicon.com,
        yangyicong@...wei.com, tim.c.chen@...ux.intel.com,
        tiantao6@...ilicon.com, Jonathan.Cameron@...wei.com,
        linuxarm@...wei.com
Subject: Re: [PATCH v4 0/4] use bin_attribute to avoid cpumap buff overflow

On Thu, Jun 17, 2021 at 10:19:06PM +1200, Barry Song wrote:
> patch #1 adds a new function cpumap_print_to_buf and patch #2 uses
> this function in drivers/base/topology.c, and patch #3 uses this new
> function in drivers/base/node.c.
> patch #4 adds test cases for the new API.

So, the root problem here is that some machines have so many CPUs that
their cpumask text representation may not fit into the full page in the
worst case. Is my understanding correct? Can you share an example of
such configuration?

I think that the proper solution would be to create a function like 
void *cpumap_alloc_pagebuf(bool list), so that cpumap_print_to_pagebuf()
will be always passed with enough portion of memory, and we'll just drop
the PAGE_SIZE limit in cpumap_print_to_pagebuf().

> 
> v4:
> add test cases for bitmap_print_to_buf API;
> add Reviewed-by of Jonathan Cameron for patches 1-3, thanks!
> 
> v3:
> fixed the strlen issue and patch #1,#2,#3 minor formatting issues, thanks
> to Andy Shevchenko and Jonathan Cameron.
> 
> v2:
> split the original patch #1 into two patches and use kasprintf() in
> patch #1 to simplify the code. do some minor formatting adjustments.
> 
> Barry Song (1):
>   lib: test_bitmap: add bitmap_print_to_buf test cases
> 
> Tian Tao (3):
>   lib: bitmap: introduce bitmap_print_to_buf
>   topology: use bin_attribute to avoid buff overflow
>   drivers/base/node.c: use bin_attribute to avoid buff overflow
> 
>  drivers/base/node.c     |  52 +++++++++-----
>  drivers/base/topology.c | 115 +++++++++++++++++--------------
>  include/linux/bitmap.h  |   2 +
>  include/linux/cpumask.h |  21 ++++++
>  lib/bitmap.c            |  37 +++++++++-
>  lib/test_bitmap.c       | 149 ++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 304 insertions(+), 72 deletions(-)
> 
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ