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]
Date: Wed, 27 Dec 2023 16:17:34 -0800
From: Tanzir Hasan <tanzirh@...gle.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Andy Lutomirski <luto@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, 
	Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, 
	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org, 
	Nick Desaulniers <nnn@...gle.com>
Subject: Re: [PATCH] x86/syscalls: shrink entry/syscall_32.i via IWYU

On Wed, Dec 27, 2023 at 3:34 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On Wed, Dec 27, 2023 at 10:38:41PM +0000, Tanzir Hasan wrote:
> > This diff uses an open source tool include-what-you-use (IWYU) to modify
> > the include list, changing indirect includes to direct includes. IWYU is
> > implemented using the IWYUScripts github repository which is a tool that
> > is currently undergoing development. These changes seek to improve build
> > times.
> >
> > This change to entry/syscall_32.c resulted in a preprocessed size of
> > entry/syscall_32.i from 64002 lines to 47986 lines (-25%) for the x86
> > defconfig.
> >
> > Signed-off-by: Tanzir Hasan <tanzirh@...gle.com>
> > ---
> >  arch/x86/entry/syscall_32.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
> > index 8cfc9bc73e7f..66db11fe8a1c 100644
> > --- a/arch/x86/entry/syscall_32.c
> > +++ b/arch/x86/entry/syscall_32.c
> > @@ -4,7 +4,7 @@
> >  #include <linux/linkage.h>
> >  #include <linux/sys.h>
> >  #include <linux/cache.h>
> > -#include <linux/syscalls.h>
> > +#include <linux/ptrace.h>
> >  #include <asm/syscall.h>
>
> Really?  What do we need linux/ptrace.h for?  Because if it's
> struct pt_regs for the generated externs, we might as well have
> just said
> struct pt_regs;
> and that would be it.
>
> <digs around a bit>
>
> As the matter of fact, all you need out of those includes is this:
>
> struct pt_regs;
> typedef long (*sys_call_ptr_t)(const struct pt_regs *);
> extern const sys_call_ptr_t sys_call_table[];
> #if defined(CONFIG_X86_32)
> #define ia32_sys_call_table sys_call_table
> #else
> /*
>  * These may not exist, but still put the prototypes in so we
>  * can use IS_ENABLED().
>  */
> extern const sys_call_ptr_t ia32_sys_call_table[];
> extern const sys_call_ptr_t x32_sys_call_table[];
> #endif

I see that only pt_regs is necessary and I understand this approach.
I was wondering if using this approach would reduce readability.
Once we add the snippet, the file builds even after removing the
following lines:
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <linux/ptrace.h>
#include <asm/syscall.h>

It is possible to remove them all, but do you think any should be kept?

Best,
Tanzir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ