[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG_fn=Wo-RyxDDvV3bVugfxzxxQN75GaOoRhKOQv1b5yrbPynQ@mail.gmail.com>
Date: Tue, 14 Feb 2023 14:33:31 +0100
From: Alexander Potapenko <glider@...gle.com>
To: Heiko Carstens <hca@...ux.ibm.com>
Cc: Baoquan He <bhe@...hat.com>, Sven Schnelle <svens@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Marco Elver <elver@...gle.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Michael Ellerman <mpe@...erman.id.au>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] s390/kfence: fix page fault reporting
On Mon, Feb 13, 2023 at 7:39 PM Heiko Carstens <hca@...ux.ibm.com> wrote:
>
> Baoquan He reported lots of KFENCE reports when /proc/kcore is read,
> e.g. with crash or even simpler with dd:
>
> BUG: KFENCE: invalid read in copy_from_kernel_nofault+0x5e/0x120
> Invalid read at 0x00000000f4f5149f:
> copy_from_kernel_nofault+0x5e/0x120
> read_kcore+0x6b2/0x870
> proc_reg_read+0x9a/0xf0
> vfs_read+0x94/0x270
> ksys_read+0x70/0x100
> __do_syscall+0x1d0/0x200
> system_call+0x82/0xb0
>
> The reason for this is that read_kcore() simply reads memory that might
> have been unmapped by KFENCE with copy_from_kernel_nofault(). Any fault due
> to pages being unmapped by KFENCE would be handled gracefully by the fault
> handler (exception table fixup).
>
> However the s390 fault handler first reports the fault, and only afterwards
> would perform the exception table fixup. Most architectures have this in
> reversed order, which also avoids the false positive KFENCE reports when an
> unmapped page is accessed.
>
> Therefore change the s390 fault handler so it handles exception table
> fixups before KFENCE page faults are reported.
>
> Reported-by: Baoquan He <bhe@...hat.com>
> Signed-off-by: Heiko Carstens <hca@...ux.ibm.com>
Acked-by: Alexander Potapenko <glider@...gle.com>
Powered by blists - more mailing lists