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]
Date:   Fri, 10 Sep 2021 15:20:55 -0500
From:   Rob Herring <robh@...nel.org>
To:     Keith Packard <keithpac@...zon.com>
Cc:     linux-kernel@...r.kernel.org, Abbott Liu <liuwenliang@...wei.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Ard Biesheuvel <ardb@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Ben Segall <bsegall@...gle.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        bpf@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Dennis Zhou <dennis@...nel.org>, devicetree@...r.kernel.org,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Frank Rowand <frowand.list@...il.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Ingo Molnar <mingo@...hat.com>,
        Jason Wang <jasowang@...hat.com>, Jens Axboe <axboe@...nel.dk>,
        Joe Perches <joe@...ches.com>,
        John Fastabend <john.fastabend@...il.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        KP Singh <kpsingh@...nel.org>, kvm@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-arch@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mm@...ck.org, Manivannan Sadhasivam <mani@...nel.org>,
        Marc Zyngier <maz@...nel.org>, Martin KaFai Lau <kafai@...com>,
        Mel Gorman <mgorman@...e.de>,
        Michael Ellerman <mpe@...erman.id.au>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        Mike Rapoport <rppt@...nel.org>, netdev@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nick Desaulniers <ndesaulniers@...ogle.com>,
        Nicolas Pitre <nico@...xnic.net>,
        Peter Zijlstra <peterz@...radead.org>,
        Russell King <linux@...linux.org.uk>,
        Song Liu <songliubraving@...com>,
        Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Tejun Heo <tj@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Valentin Schneider <valentin.schneider@....com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        virtualization@...ts.linux-foundation.org,
        "Wolfram Sang (Renesas)" <wsa+renesas@...g-engineering.com>,
        YiFei Zhu <yifeifz2@...inois.edu>, Yonghong Song <yhs@...com>
Subject: Re: [PATCH v4 4/7] Make sure task_struct is available for
 raw_smp_processor_id

On Wed, Sep 08, 2021 at 12:06:02PM -0700, Keith Packard wrote:
> To allow architectures to use the 'cpu' field in task_struct for cpu
> identification, the task_struct must be visible whereever the
> raw_smp_processor_id macro is used. It would be simplest to include
> linux/sched.h from the relevant asm/smp.h file, but that file is
> included from linux/sched.h, and the recursive include ends up with
> several declarations in the wrong order.
> 
> To avoid this, the PowerPC architecture code has this ugly hack:
> 
> 	#define raw_smp_processor_id() \
> 		(*(unsigned int *)((void *)current + _TASK_CPU))
> 
> As an alternative, placing includes of linux/sched.h in a few files
> that are used along with asm/smp.h means we can use the task_struct
> field directly.
> 
> Signed-off-by: Keith Packard <keithpac@...zon.com>
> ---
>  arch/arm/mm/proc-v7-bugs.c     | 1 +
>  drivers/vhost/vhost.c          | 1 +
>  drivers/vhost/vhost.h          | 1 +
>  include/asm-generic/irq_regs.h | 1 +
>  include/linux/of_address.h     | 1 +

Where does the DT code use raw_smp_processor_id()? The header itself 
certainly doesn't and the headers should only include what the headers 
use directly.

In general this seems pretty terrible pulling in all of sched.h (and 
then everything else it includes) for just raw_smp_processor_id().

>  include/linux/random.h         | 1 +
>  include/linux/topology.h       | 1 +
>  init/calibrate.c               | 1 +
>  kernel/bpf/bpf_lru_list.h      | 1 +
>  kernel/bpf/percpu_freelist.h   | 1 +
>  kernel/sched/cpuacct.c         | 2 +-
>  lib/irq_regs.c                 | 1 +
>  12 files changed, 12 insertions(+), 1 deletion(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ