[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180320085932.xnwkpiz5gpegnw5d@gmail.com>
Date: Tue, 20 Mar 2018 09:59:32 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
linux-arch <linux-arch@...r.kernel.org>,
Ralf Baechle <ralf@...ux-mips.org>,
James Hogan <jhogan@...nel.org>,
linux-mips <linux-mips@...ux-mips.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
ppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-s390 <linux-s390@...r.kernel.org>,
"David S . Miller" <davem@...emloft.net>,
sparclinux@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Jiri Slaby <jslaby@...e.com>,
the arch/x86 maintainers <x86@...nel.org>
Subject: Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead()
implementation
* Al Viro <viro@...IV.linux.org.uk> wrote:
> > For example this attempt at creating a new system call:
> >
> > SYSCALL_DEFINE3(moron, int, fd, loff_t, offset, size_t, count)
> >
> > ... would translate into something like:
> >
> > .name = "moron", .pattern = "WWW", .type = "int", .size = 4,
> > .name = NULL, .type = "loff_t", .size = 8,
> > .name = NULL, .type = "size_t", .size = 4,
> > .name = NULL, .type = NULL, .size = 0, /* end of parameter list */
> >
> > i.e. "WDW". The build-time constraint checker could then warn about:
> >
> > # error: System call "moron" uses invalid 'WWW' argument mapping for a 'WDW' sequence
> > # please avoid long-long arguments or use 'SYSCALL_DEFINE3_WDW()' instead
>
> ... if you do 32bit build.
Yeah - but the checking tool could do a 32-bit sizing of the types and thus the
checks would work on all arches and on all bitness settings.
I don't think doing part of this in CPP is a good idea:
- It won't be able to do the full range of checks
- Wrappers should IMHO be trivial and open coded as much as possible - not hidden
inside several layers of macros.
- There should be a penalty for newly introduced, badly designed system call
ABIs, while most CPP variants I can think of will just make bad but solvable
decisions palatable, AFAICS.
I.e. I think the way out of this would be two steps:
1) for new system calls: hard-enforce the highest quality at the development
stage and hard-reject crap. No new 6-parameter system calls or badly ordered
arguments. The tool would also check new extensions to existing system calls,
i.e. no more "add a crappy 4th argument to an existing system call that works
on x86 but hurts MIPS".
2) for old legacies: cleanly open code all our existing legacies and weird
wrappers. No new muck will be added to it so the line count does not matter.
... is there anything I'm missing?
Thanks,
Ingo
Powered by blists - more mailing lists