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: <20220830150549.afa67340c2f5eb33ff9615f4@linux-foundation.org>
Date:   Tue, 30 Aug 2022 15:05:49 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Alexander Potapenko <glider@...gle.com>,
        Yu Zhao <yuzhao@...gle.com>
Cc:     Marco Elver <elver@...gle.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Borislav Petkov <bp@...en8.de>,
        Christoph Hellwig <hch@....de>,
        Christoph Lameter <cl@...ux.com>,
        David Rientjes <rientjes@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Ilya Leoshkevich <iii@...ux.ibm.com>,
        Ingo Molnar <mingo@...hat.com>, Jens Axboe <axboe@...nel.dk>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Kees Cook <keescook@...omium.org>,
        Mark Rutland <mark.rutland@....com>,
        Matthew Wilcox <willy@...radead.org>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Pekka Enberg <penberg@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Vegard Nossum <vegard.nossum@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Linux-Arch <linux-arch@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 04/44] x86: asm: instrument usercopy in get_user()
 and put_user()

On Tue, 30 Aug 2022 16:23:44 +0200 Alexander Potapenko <glider@...gle.com> wrote:

> >                  from init/do_mounts.c:2:
> > ./include/linux/page-flags.h: In function ‘page_fixed_fake_head’:
> > ./include/linux/page-flags.h:226:36: error: invalid use of undefined type ‘const struct page’
> >   226 |             test_bit(PG_head, &page->flags)) {
> >       |                                    ^~
> > ./include/linux/bitops.h:50:44: note: in definition of macro ‘bitop’
> >    50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
> >       |                                            ^~~~
> > ./include/linux/page-flags.h:226:13: note: in expansion of macro ‘test_bit’
> >   226 |             test_bit(PG_head, &page->flags)) {
> >       |             ^~~~~~~~
> > ...
> 
> Gotcha, this is a circular dependency: mm_types.h -> sched.h ->
> kmsan.h -> gfp.h -> mmzone.h -> page-flags.h -> mm_types.h, where the
> inclusion of sched.h into mm_types.h was only introduced in "mm:
> multi-gen LRU: support page table walks" - that's why the problem was
> missing in other trees.

Ah, thanks for digging that out.

Yu, that inclusion is regrettable.  I don't think mm_types.h is an
appropriate site for implementing lru_gen_use_mm() anyway.  Adding a
new header is always the right fix for these things.  I'd suggest
adding a new mglru.h (or whatever) and putting most/all of the mglru
material in there.

Also, the addition to kernel/sched/core.c wasn't clearly changelogged,
is uncommented and I doubt if the sched developers know about it, let
alone reviewed it.  Please give them a heads-up.

The addition looks fairly benign, but core context_switch() is the
sort of thing which people get rather defensive about and putting
mm-specific stuff in there might be challenged.  Some quantitative
justification of this optimization would be appropriate.

> In fact sched.h only needs the definitions of `struct
> kmsan_context_state` and `struct kmsan_ctx` from kmsan.h, so I am
> splitting them off into kmsan_types.h to break this circle.
> Doing so also helped catch a couple of missing/incorrect inclusions of
> KMSAN headers in subsystems.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ