On Tue, Feb 11, 2025 at 8:34 AM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > On Tue, Feb 11, 2025, at 17:18, Ian Rogers wrote: > > On Mon, Feb 10, 2025 at 11:48 PM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > >> The syscall numbers on mips (and previously on ia64) are offset by > >> a large number depending on the ABI (o32/n32/n64). I assume what > >> we want here is to have the small numbers without the offset in > >> syscall_num_to_name[], but that requires adding the offset during > >> the lookup. Can you check if this is handled correctly? > > > > Thanks Arnd! I agree the tables are large and can be sparse, they'll > > also be full of relocations. MIPS doesn't look like an outlier to me > > here: > > Sorry, I should have been clearer what I meant, see > arch/mips/include/uapi/asm/unistd.h: > > #if _MIPS_SIM == _MIPS_SIM_NABI32 > #define __NR_Linux 6000 > #include <asm/unistd_n32.h> > #endif > > and > arch/mips/include/generated/uapi/asm/unistd_n32.h > > #define __NR_read (__NR_Linux + 0) > #define __NR_write (__NR_Linux + 1) > #define __NR_open (__NR_Linux + 2) > > These offsets are 4000/5000/6000 respectively. > > > ``` > > #if defined(ALL_SYSCALLTBL) || defined(__mips__) > > static const char *const syscall_num_to_name_EM_MIPS[] = { > > [0] = "read", > > [1] = "write", > > [2] = "open", > > ... > > [465] = "listxattrat", > > [466] = "removexattrat", > > }; > > This means the array is not sparse, but the numbers > here do not match the syscall number argument register. > > The question is whether tracing on mips adds the same > per-ABI offset again, or if it tries and fails to look > up index 6002 for 'open'. Thanks for clarifying. I believe it will use 6002 and be broken. I believe that'd be true without these changes too. I'm not testing on MIPS so it'd be nice to have a fix targeted at making it work. Ideally we wouldn't use __NR_Linux and instead fudge the id/system call number based on e_machine/e_flags. I think it is follow on work, especially because I don't find MIPS a very motivating use-case. Thanks, Ian