lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4C66dg+9wwiXdVs@leoy-yangtze.lan>
Date:   Fri, 25 Nov 2022 20:54:01 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Vincent Whitchurch <vincent.whitchurch@...s.com>,
        Arnd Bergmann <arnd@...db.de>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Hans-Peter Nilsson <hp@...s.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        John Garry <john.garry@...wei.com>,
        Will Deacon <will@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Kim Phillips <kim.phillips@....com>
Subject: Re: [PATCH] perf arm64: Fix mksyscalltbl, don't lose syscalls due to
 sort -nu

Hi Vincent,

[ + Arnd ]

On Fri, Nov 25, 2022 at 12:53:10PM +0100, Vincent Whitchurch wrote:
> On Tue, Dec 29, 2020 at 11:09:33AM +0800, Leo Yan wrote:
> > On Mon, Dec 28, 2020 at 03:39:41AM +0100, Hans-Peter Nilsson wrote:
> > > When using "sort -nu", arm64 syscalls were lost.  That is, the
> > > io_setup syscall (number 0) and all but one (typically
> > > ftruncate; 64) of the syscalls that are defined symbolically
> > > (like "#define __NR_ftruncate __NR3264_ftruncate") at the point
> > > where "sort" is applied.
> > > 
> > > This creation-of-syscalls.c-scheme is, judging from comments,
> > > copy-pasted from powerpc, and worked there because at the time,
> > > its tools/arch/powerpc/include/uapi/asm/unistd.h had *literals*,
> > > like "#define __NR_ftruncate 93".
> > > 
> > > With sort being numeric and the non-numeric key effectively
> > > evaluating to 0, the sort option "-u" means these "duplicates"
> > > are removed.  There's no need to remove syscall lines with
> > > duplicate numbers for arm64 because there are none, so let's fix
> > > that by just losing the "-u".  Having the table numerically
> > > sorted on syscall-number for the rest of the syscalls looks
> > > nice, so keep the "-n".
> > > 
> > > Signed-off-by: Hans-Peter Nilsson <hp@...s.com>
> > 
> > Very good catching!  I tested this patch with the commands:
> > 
> > $ cd $LINUX_KERN
> > $ tools/perf/arch/arm64/entry/syscalls/mksyscalltbl \
> >         $ARM64_TOOLCHAIN_PATH/aarch64-linux-gnu-gcc \
> >         gcc tools tools/include/uapi/asm-generic/unistd.h
> > 
> > It gives out complete syscall tables:
> > 
> > $ diff /tmp/mksyscall_before.txt /tmp/mksyscall_after.txt
> > 1a2,4
> > > 	[223] = "fadvise64",
> > > 	[25] = "fcntl",
> > > 	[44] = "fstatfs",
> > 2a6,11
> > > 	[0] = "io_setup",
> > > 	[62] = "lseek",
> > > 	[222] = "mmap",
> > > 	[71] = "sendfile",
> > > 	[43] = "statfs",
> > > 	[45] = "truncate",
> > 
> > Rather than dropping option "-u" for sort command, I googled and read
> > the manual of "sort", but cannot find other better method.  So this
> > patch looks good for me:
> > 
> > Reviewed-by: Leo Yan <leo.yan@...aro.org>
> > Tested-by: Leo Yan <leo.yan@...aro.org>
> 
> It looks like this patch was never applied?  AFAICS it is still needed
> on current HEAD and it still applies cleanly.

Thanks a lot for bringing up this.

Before there have a discussion [1] for refactoring Arm64 system call
table but it didn't really happen. I think it's the right thing to merge
this patch, @Arnaldo, could you pick up this patch?

Thanks,
Leo

[1] https://lore.kernel.org/lkml/CAK8P3a1G2YHh2FRd=vBY4xxsJ1wZFh2pB1wyw82QmQOaiV4+CA@mail.gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ