[0/3] Handle delay slot for extable lookup

Message ID 20240201-exception_ip-v1-0-aa26ab3ee0b5@flygoat.com
Headers
Series Handle delay slot for extable lookup |

Message

Jiaxun Yang Feb. 1, 2024, 3:46 p.m. UTC
  Hi all,

This series fixed extable handling for architecture delay slot (MIPS).

Please see previous discussions at [1].

There are some other places in kernel not handling delay slots properly,
such as uprobe and kgdb, I'll sort them later.

Thanks!

[1]: https://lore.kernel.org/lkml/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site

To: Oleg Nesterov <oleg@redhat.com>

To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

To: Andrew Morton <akpm@linux-foundation.org>
To: Ben Hutchings <ben@decadent.org.uk>

Cc:  <linux-arch@vger.kernel.org>
Cc:  <linux-kernel@vger.kernel.org>

Cc:  <linux-mips@vger.kernel.org>

Cc:  <linux-mm@kvack.org>

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Jiaxun Yang (3):
      ptrace: Introduce exception_ip arch hook
      MIPS: Clear Cause.BD in instruction_pointer_set
      mm/memory: Use exception ip to search exception tables

 arch/alpha/include/asm/ptrace.h        | 1 +
 arch/arc/include/asm/ptrace.h          | 1 +
 arch/arm/include/asm/ptrace.h          | 1 +
 arch/csky/include/asm/ptrace.h         | 1 +
 arch/hexagon/include/uapi/asm/ptrace.h | 1 +
 arch/loongarch/include/asm/ptrace.h    | 1 +
 arch/m68k/include/asm/ptrace.h         | 1 +
 arch/microblaze/include/asm/ptrace.h   | 3 ++-
 arch/mips/include/asm/ptrace.h         | 2 ++
 arch/mips/kernel/ptrace.c              | 7 +++++++
 arch/nios2/include/asm/ptrace.h        | 3 ++-
 arch/openrisc/include/asm/ptrace.h     | 1 +
 arch/parisc/include/asm/ptrace.h       | 1 +
 arch/s390/include/asm/ptrace.h         | 1 +
 arch/sparc/include/asm/ptrace.h        | 2 ++
 arch/um/include/asm/ptrace-generic.h   | 1 +
 mm/memory.c                            | 4 ++--
 17 files changed, 28 insertions(+), 4 deletions(-)
---
base-commit: 06f658aadff0e483ee4f807b0b46c9e5cba62bfa
change-id: 20240131-exception_ip-194e4ad0e6ca

Best regards,
  

Comments

Linus Torvalds Feb. 1, 2024, 5:48 p.m. UTC | #1
On Thu, 1 Feb 2024 at 07:46, Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
>  arch/alpha/include/asm/ptrace.h        | 1 +
>  arch/arc/include/asm/ptrace.h          | 1 +
>  arch/arm/include/asm/ptrace.h          | 1 +
>  arch/csky/include/asm/ptrace.h         | 1 +
>  arch/hexagon/include/uapi/asm/ptrace.h | 1 +
>  arch/loongarch/include/asm/ptrace.h    | 1 +
>  arch/m68k/include/asm/ptrace.h         | 1 +
>  arch/microblaze/include/asm/ptrace.h   | 3 ++-
>  arch/mips/include/asm/ptrace.h         | 2 ++
>  arch/mips/kernel/ptrace.c              | 7 +++++++
>  arch/nios2/include/asm/ptrace.h        | 3 ++-
>  arch/openrisc/include/asm/ptrace.h     | 1 +
>  arch/parisc/include/asm/ptrace.h       | 1 +
>  arch/s390/include/asm/ptrace.h         | 1 +
>  arch/sparc/include/asm/ptrace.h        | 2 ++
>  arch/um/include/asm/ptrace-generic.h   | 1 +
>  mm/memory.c                            | 4 ++--
>  17 files changed, 28 insertions(+), 4 deletions(-)

The only user right now is mm/memory.c, and it doesn't even include
<asm/ptrace.h>, but instead does the proper thing and includes
<linux/ptrace.h>

So please make <linux/ptrace.h> just do

     #ifndef exception_ip
        #define exception_ip(x) instruction_pointer(x)
    #endif

and all those non-MIPS architecture updates should just go away, and
the diffstat should look something like

  arch/mips/kernel/ptrace.c          | 7 +++++++
  include/linux/ptrace.h             | 4 ++++
  mm/memory.c                        | 4 ++--

instead.

                  Linus