[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210902165353.GI22278@shell.armlinux.org.uk>
Date: Thu, 2 Sep 2021 17:53:53 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Keith Packard <keithp@...thp.com>
Cc: linux-kernel@...r.kernel.org, Abbott Liu <liuwenliang@...wei.com>,
Alexander Sverdlin <alexander.sverdlin@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Ard Biesheuvel <ardb@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Florian Fainelli <f.fainelli@...il.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Hartley Sweeten <hsweeten@...ionengravers.com>,
Jens Axboe <axboe@...nel.dk>, Jian Cai <jiancai@...gle.com>,
Joe Perches <joe@...ches.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-arm-kernel@...ts.infradead.org,
Maninder Singh <maninder1.s@...sung.com>,
Manivannan Sadhasivam <mani@...nel.org>,
Marc Zyngier <maz@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nick Desaulniers <ndesaulniers@...ogle.com>,
Nicolas Pitre <nico@...xnic.net>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Valentin Schneider <valentin.schneider@....com>,
Vaneet Narang <v.narang@...sung.com>,
"Wolfram Sang (Renesas)" <wsa+renesas@...g-engineering.com>,
YiFei Zhu <yifeifz2@...inois.edu>,
Keith Packard <keithpac@...zon.com>
Subject: Re: [PATCH 0/2]: ARM: Enable THREAD_INFO_IN_TASK
On Thu, Sep 02, 2021 at 08:54:26AM -0700, Keith Packard wrote:
> Placing thread_info in the kernel stack leaves it vulnerable to stack
> overflow attacks. This short series addresses that by using the
> existing THREAD_INFO_IN_TASK infrastructure.
>
> As this is my first patch in this part of the kernel, I'm looking for
> feedback about the general approach as well as specific comments on
> places where I've missed something.
>
> I've only run this on armhf running under qemu, so while I've tried to
> make patches for other code paths, I haven't been able to test those.
>
> (yes, I know checkpatch.pl complains about whitespace in asm-offsets.c, I
> decided to leave the existing whitespace alone)
>
> Signed-off-by: Keith Packard <keithpac@...zon.com>
I think you're introducing a circular dependency with this for
certain kernel configurations:
E.g. Have you tried running this with CONFIG_CPU_V6 enabled?
+#define raw_smp_processor_id() this_cpu_read(cpu_number)
+#define __smp_processor_id() __this_cpu_read(cpu_number)
+
+DECLARE_PER_CPU_READ_MOSTLY(unsigned int, cpu_number);
this_cpu_read() is defined as:
#define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
(which will call this_cpu_read_4)
#define this_cpu_read_4(pcp) this_cpu_generic_read(pcp)
=> __this_cpu_generic_read_nopreempt()
=> ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));
#define raw_cpu_ptr(ptr) \
({ \
__verify_pcpu_ptr(ptr); \
arch_raw_cpu_ptr(ptr); \
})
#ifndef arch_raw_cpu_ptr
#define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
#endif
#ifndef __my_cpu_offset
#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
#endif
... which then leads back to a use of raw_smp_processor_id(), thereby
creating a circular loop of preprocessor definitions that the compiler
can't resolve.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists