From: Peter Zijlstra <peterz@infradead.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Sathvika Vasireddy <sv@linux.ibm.com>,
Naveen N Rao <naveen@kernel.org>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4)
Date: Wed, 12 Jul 2023 16:23:51 +0200 [thread overview]
Message-ID: <20230712142351.GJ3100107@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <cover.1689091394.git.christophe.leroy@csgroup.eu>
On Tue, Jul 11, 2023 at 06:08:26PM +0200, Christophe Leroy wrote:
> This series adds UACCESS validation for PPC32. It includes
> a dozen of changes to objtool core.
>
> It applies on top of series "Cleanup/Optimise KUAP (v3)"
> https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=363368&state=*
That contains:
+static __always_inline void uaccess_begin_32s(unsigned long addr)
+{
+ unsigned long tmp;
+
+ asm volatile(ASM_MMU_FTR_IFSET(
+ "mfsrin %0, %1;"
+ "rlwinm %0, %0, 0, %2;"
+ "mtsrin %0, %1;"
+ "isync", "", %3)
+ : "=&r"(tmp)
+ : "r"(addr), "i"(~SR_KS), "i"(MMU_FTR_KUAP)
+ : "memory");
+}
+
+static __always_inline void uaccess_end_32s(unsigned long addr)
+{
+ unsigned long tmp;
+
+ asm volatile(ASM_MMU_FTR_IFSET(
+ "mfsrin %0, %1;"
+ "oris %0, %0, %2;"
+ "mtsrin %0, %1;"
+ "isync", "", %3)
+ : "=&r"(tmp)
+ : "r"(addr), "i"(SR_KS >> 16), "i"(MMU_FTR_KUAP)
+ : "memory");
+}
And I am a bit puzzled by the isync placement of uaccess_end, should
that not start with the isync, to ensure completion of the uaccess
region before disabling it?
Or is that not the purpose of the isync?
> It is almost mature, performs code analysis for all PPC32.
>
> In this version objtool switch table lookup has been enhanced to
> handle nested switch tables.
>
> Most object files are correctly decoded, only a few
> 'unreachable instruction' warnings remain due to more complex
> fonctions which include back and forth jumps or branches.
>
> It allowed to detect some UACCESS mess in a few files. They've been
> fixed through other patches.
>
> Changes in v4:
> - Split series in two parts, the powerpc uaccess rework is submitted
> separately, see https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=363368&state=*
> - Support of UACCESS on all PPC32 including book3s/32 which was missing in v3.
> - More elaborated switch tables lookup.
> - Patches 2, 7, 8, 9, 10, 11 are new
> - Patch 11 in series v3 is now removed.
The patches look eminently reasonable to me; Josh, could you please have
a look?
next prev parent reply other threads:[~2023-07-12 14:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 16:08 Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 01/15] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 02/15] objtool: Move back misplaced comment Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 03/15] objtool: Allow an architecture to disable objtool on ASM files Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 04/15] objtool: Fix JUMP_ENTRY_SIZE for bi-arch like powerpc Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 05/15] objtool: Add INSN_RETURN_CONDITIONAL Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 06/15] objtool: Add support for relative switch tables Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 07/15] objtool: Merge mark_func_jump_tables() and add_func_jump_tables() Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 08/15] objtool: Track general purpose register used for switch table base Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 09/15] objtool: Find end of switch table directly Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 10/15] objtool: When looking for switch tables also follow conditional and dynamic jumps Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 11/15] objtool: .rodata.cst{2/4/8/16} are not switch tables Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 12/15] objtool: Add support for more complex UACCESS control Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 13/15] objtool: Prepare noreturns.h for more architectures Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 14/15] powerpc/bug: Annotate reachable after warning trap Christophe Leroy
2023-07-11 16:08 ` [PATCH v4 15/15] powerpc: Implement UACCESS validation on PPC32 Christophe Leroy
2023-07-12 14:23 ` Peter Zijlstra [this message]
2023-07-12 16:29 ` [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4) Christophe Leroy
2023-07-20 13:50 ` (subset) " Michael Ellerman
2023-07-21 5:00 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230712142351.GJ3100107@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=sv@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®