[PATCH] set saner MAX_ARGS
dvlasenk at redhat.com
Tue Aug 23 16:08:27 UTC 2011
On Fri, 2011-08-19 at 22:55 +0400, Dmitry V. Levin wrote:
> On Fri, Aug 19, 2011 at 05:38:19PM +0200, Denys Vlasenko wrote:
> > On Fri, 2011-08-19 at 00:02 +0400, Dmitry V. Levin wrote:
> > > > --- strace.5/defs.h 2011-08-18 11:57:30.512416447 +0200
> > > > +++ strace.6/defs.h 2011-08-18 11:46:56.349540479 +0200
> > > > @@ -64,7 +64,7 @@
> > > > #define DEFAULT_ACOLUMN 40 /* default alignment column for results */
> > > > #endif
> > > > #ifndef MAX_ARGS
> > > > -# ifdef HPPA
> > > > +# if defined HPPA || defined X86_64 || defined I386
> > > > # define MAX_ARGS 6 /* maximum number of args to a syscall */
> > > > # else
> > > > /* Way too big. Switch your arch to saner size after you tested that it works */
> > >
> > > What about other architectures? Is there any with MAX_ARGS > 6?
> > > Can we assume MAX_ARGS == 6 on linux?
> > I looked deeper. Apparently FREEBSD needs MAX_ARGS = 8. Also there's
> > a bug in sys_mmap64 where it will try to access (but not write to)
> > u_args[6,7] wrongly - see other mail.
> > My current knowledge is summed up by this comment:
> > /* Maximum number of args to a syscall.
> > *
> > * Make sure that all entries in all syscallent.h files
> > * have nargs <= MAX_ARGS!
> > * linux/<ARCH>/syscallent.h: ia64 has many syscalls with
> > * nargs = 8, mips has two with nargs = 7 (both are printargs),
> > * all others are <= 6.
> > * freebsd/i386/syscallent.h: one syscall with nargs = 8
> > * (sys_sendfile, looks legitimate)
> > * and one with nargs = 7 (sys_mmap, maybe it should have 6?).
> > * sunos4/syscallent.h: all are <= 6.
> > * svr4/syscallent.h: all are -1.
> > */
> > Basically, all linux arches sans ia64 should be ok with MAX_ARGS = 6.
> All linux/ia64/syscallent.h entries with nargs == 8 are printargs.
> I checked those 3 of them that have meaningful sys_name (other than SYS_*),
> they definitely take less than 6 arguments. So I suppose ia64 entries
> with nargs == 8 are just wrong, and we can safely assume MAX_ARGS == 6
> on linux.
I agree. Just pushed a change which sets MAX_ARGS to 6 for all Linux
builds, and changes ia64 and mips printagrs to use MAX_ARGS, not 7 or 8.
More information about the Strace-devel