Commit Graph

230 Commits

Author SHA1 Message Date
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
dogcow 2fa8120f7e fallout from si_sigval -> si_value 2007-05-21 19:29:44 +00:00
njoly f7ed257809 When decoding ioctl commands type; do not output non printable
characters, but the corresponding hexadecimal values.

ok by christos
2007-03-19 18:51:09 +00:00
he b2898f296c Add two more ioctl values which are the same. 2007-03-05 17:38:25 +00:00
ad 401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +00:00
njoly e7544f933f compat linux32 depends on compat netbsd32, and thus needs
EMUL_FLAG_NETBSD32.

ok by manu
2007-02-07 13:58:12 +00:00
chs aaf6e758a0 skip over the "self" sa when printing upcalls. 2007-01-28 21:29:59 +00:00
elad 4cfb3b3658 Conflict was resolved, so revert previous.
Okay dogcow@.
2006-11-30 01:59:45 +00:00
dogcow 48de5cde28 deal with VERIEXEC_LOAD/SPKRTONE conflict 2006-11-29 03:48:57 +00:00
mrg dbdbfa2c22 since register_t is sometimes unsigned, cast to (long) to check >= 0. 2006-10-23 04:13:51 +00:00
peter e263dfd62f WFORMAT is no more... 2006-10-08 17:52:28 +00:00
manu 8a1037a46b Add a -t+S flag to ktrace for tracing activity related to sysctl. MIB
names will be displayed, with data readen and written as well.
2006-09-23 22:01:04 +00:00
he 0b5587a884 Provide a dummy default for NBPG after including <sys/param.h> to deal
with a build problem for sparc.  The reason is that <dev/tc/sticio.h>
(yes, irrelevant for sparc...) wants NBPG declared, but for sparc user-land
that symbol is not available since sun4/sun4c/sun4m do not all share the
same page size.
2006-08-31 22:41:14 +00:00
he 276f9c838b Add one more conflicting ioctl set: CLOCKCTL_ADJTIME / TCTRL_MODEM_PWR,
(partially) fixes build problem for sparc.
2006-08-31 22:25:34 +00:00
he 061f5e8762 Add handling of two more pairs of duplicate ioctl values: amiga's
and x68k's PARIOC[SG]PARAM reuse the ioctl values from sbus/mbppio.h's
MBPPIOC[SG]PARAM.

Suggested by Christos.
2006-08-30 23:26:25 +00:00
christos 659537b3d6 Fix sparc64 build; thanks to Martin S. Weber 2006-08-29 14:53:57 +00:00
christos 4de29ae80e Include <sys/device.h> needed by iopio.h 2006-08-27 21:41:18 +00:00
christos 5699156510 pick up ioctls from other devices too. 2006-08-27 20:31:26 +00:00
christos 286191634b We don't need to define struct ap_control anymore 2006-06-03 03:15:24 +00:00
christos 7042b96381 SIOCLOOKUPSTAT is the same as SIOCPROXY. 2006-06-03 00:02:51 +00:00
christos 5e5752c8cd PR/33627: Keiichi Shima: typo in Makefile.ioctl-c in kdump directory
s/RW/WR/
2006-06-02 13:56:49 +00:00
christos 394f070a3e Handle aout m68k; from Izumi Tsutsui. 2006-05-04 18:06:29 +00:00
christos c721423ddc Use the standard macros to compute the ioctl length instead of rolling our
own. Thanks to Chuck for noticing.
2006-04-05 00:50:59 +00:00
christos ef5477c67d Add PT_SYSCALL 2006-03-05 17:03:19 +00:00
manu ee0c5b44de Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
2006-02-09 19:18:56 +00:00
christos 4f17ba81bc Learn about v1 records and sa upcalls. 2005-12-11 11:31:34 +00:00
christos 64639a3896 Print symbolic signal names for killpg *sigaction* and *sigvec*. 2005-10-18 01:49:18 +00:00
christos 58fc70c4d6 WARNS=3 2005-07-16 22:00:01 +00:00
lukem a3b235bbd2 appease gcc -Wuninitialized 2005-06-02 01:53:01 +00:00
jdolecek 04fa39a4be ectx_find() failed to lookup the emulation context unless it happened
to be the first entry, effectively resetting context of all processes to
default emulation on every EMUL trace record

rewrite ectx_find() to fix this, using <sys/queue.h> LIST for readability

this fix should once and for all remove need to ever use -e option,
and makes kdump work properly for traces with processes under different
emulations
2005-01-15 17:55:38 +00:00
dsl 5ac85b92f3 Ensure a non-zero 'word_size' is passed to hexdump_buf for unknown
trace types.
Also fix an incorrect use of the global word_size variable
2004-08-23 20:49:28 +00:00
tron dc33169c5b Add prefix "${PROG}-" to filename of automatically created list of
ioctl names. This makes sure that each program is built with its own
copy even if object directories are not used. This avoids build
failures when two or more make jobs are used in parallel.
2004-07-10 12:12:49 +00:00
christos 750fc37531 deal with another dup ioctl; fortunately this is from pcvt and it will die. 2004-07-08 03:22:32 +00:00
tron d12de89293 Don't scan include files in "includes" target because they might not be
in the destination directory yet.
2004-07-07 14:28:17 +00:00
christos ab5ca5c5d6 Include ioctl's that don't have IO in their names [lkm ones eg.] 2004-06-22 17:30:52 +00:00
drochner 7723c241ec remove creation of the intermediate "sourcefile" which was for debugging 2004-05-10 20:46:44 +00:00
hannken 97b2d1519a Add "sys/dkbad.h" for DIOCSBAD from sys/dkio.h.
Use # to start comment in awk program.
2004-05-10 20:41:32 +00:00
christos ff5de51147 Change code to use a switch statement, and add exceptions to fix the
conflicts.

XXX: Fix the conflicts.

1. chio: change to 'x' from 'c' so that it does not conflict with cdio.
   keep the 'c' ioctls in the driver for compat.
2. ppp/slip: change SLCGUNIT to some other number and accept the old number
   in the driver.
3. ipf: [3 instances] Have darren fix them.
2004-05-10 15:25:57 +00:00
jmc 7492226095 Add another exception for broken includes (showed up on acorn32 build) 2004-05-08 21:03:43 +00:00
matt 10efbfd5c3 Allow kdump to print the names for machine dependent ptrace ops.
(This requires <machine/ptrace.h> to define PT_MACHDEP_STRINGS
which corresponds to the machdep ops).
2004-05-06 22:51:38 +00:00
hannken aa9b145692 Don't invoke the egrep for cleandir and obj targets. Needed for build.sh.
Use ".if !make()" instead of ".if !target()".
2004-04-23 12:05:53 +00:00
hannken 1466f8c9d9 Undo last commit -- doesn't work. 2004-04-23 09:50:21 +00:00
hannken 0c0fbf545a Don't invoke the egrep for cleandir and obj targets. Needed for build.sh. 2004-04-23 09:28:56 +00:00
christos 19e4b9c5ad Instead of pussy-footing around and grabbing a few of the ioctl's here and
there randomly, grab all the ioctls from the include files.
Read the XXX's in mkioctls about problems with our header files.
2004-04-22 22:31:18 +00:00
dsl c395262f1f Suppress duplicate lines when hexdumping data 2004-03-07 17:20:53 +00:00
enami 3f98504ee8 Fix whitespace usage and remove unnecessary semi-colon. 2004-02-27 23:06:02 +00:00
enami 6a6547d143 We can't access array[sizeof(array) / sizeof(array[0])]. 2004-02-27 22:48:56 +00:00
enami 35c4c5bed3 Calculate the width again if we start newline at tab character, since
start column changes.
2004-02-27 22:44:38 +00:00
christos 301d580988 Fix reversed logic (decimal argument passed in output_long, where it expects
hex). Change tests to <= 9 to a small(v) macro, so that negative numbers fail
too consistently.
2004-02-02 06:27:56 +00:00
mrg 7ca9a9ac30 redo the former in light of making the kernel output normal 64 bit
records for 32 bit & 64 bit processes.  we still make some adjustments
when dealing with 32-bit processes, but largely things are handled the
same now.  make the code to match "netbsd32_<syscall>" in place of
plain "<syscall>" more general.
2004-01-15 14:42:09 +00:00
mrg 2ccd4840f5 - add a new flags field to the emulation vector, with one user so far
EMUL_FLAG_NETBSD32.  set EMUL_FLAG_NETBSD32 in any 32 bit on 64 bit
kernel emulation layers.
- if EMUL_FLAG_NETBSD32 is set, calculate the proper argument count.
(XXX: this should use register32_t, but that's not visible to all
builders of kdump...)

now netbsd32_ioctl(2) actually reports sane values, and other arguments
are mostly correctly printed (there are still some signed extension
issues with 32 bit numbers being displayed as "0xffffffff8xxxxxxx".)
2004-01-12 13:39:56 +00:00
manu bb938d861a Fix cross-build problem on sparc caused by a cast size_t -> int 2003-11-24 22:12:14 +00:00
manu 23f30b17cb Enable tracing of out of line data sent with Mach messages 2003-11-24 16:53:38 +00:00
manu 32f7275395 For Mach messages, always display the message Id in decimal. The information
is indeed in the message, but in hex. It's a bit inconvenient.
2003-11-18 14:21:59 +00:00
dsl 3433691e60 Stop core dump if an ioctl trace has fewer than expected arguments.
- Check names of system calls (for special treatment) because emulations
  might use different numbers.
- Report an error if arguments to -p or -m non-numeric.
- Just take last of -x and -Xvalue, stop -X0x80000000 being valid (core dumps).
- Keep 'last used' emulation_ctx at top of list, create on lookup (usually
  EMUL anyway), delete when exit called (doesn't return).
- Slightly improve hack to get correct system call name in execve return
  when emulation has changed.
- Rename global variables 'current'/'previous' to 'cur_emul'/'prev_emul'.
(TODO: save system call type (and maybe an argument) per pid so GIO trace
format can depend on the actual system call.)
Fixes part of PR sparc64/23473 - but system call arguments will still not be
displayed correctly.
2003-11-18 13:21:53 +00:00
wiz 690130c2ef New sentence, new line; add comma in enumeration. 2003-11-16 23:10:00 +00:00
manu e59cd6c2b4 Following mycroft's comment, restore -x to its original behavior: without
an argument. Introduce -Xsize to do the job. -x is equivalent to -X1
Of course -x and -Xsize are mutually exclusive.
2003-11-16 21:52:33 +00:00
dsl 826153cc5c Validate the numeric argument to -x, support -x1|2|4|8|16.
Produce sensible output on little-endian systems.
2003-11-16 14:51:26 +00:00
wiz e0f60703ab Bump date for previous. New sentence, new line. 2003-11-16 10:16:56 +00:00
manu 91d6d92c2e Add an argument to the -x flag to choose between byte per byte display
and word per word display in hex dumps.
-x1 gives you byte per byte, -x4 word per word, and -x defaults to -x1
2003-11-16 10:13:48 +00:00
manu 94d3385454 Re-add the static root conditionnal that was removed by mistake. 2003-11-16 10:10:37 +00:00
manu a0399121cc kdump now displays Mach services names itself, including a table of
id/names in sys/compat/mach/mach_services_names.c

Remove ports and flags displays, the information is already in the message.
2003-11-15 23:10:31 +00:00
dsl 7a7ad1c63b Look for siginfo in the correct place - otherwise kdump is rebuilt all the time. 2003-11-13 13:07:01 +00:00
matt 9bd74136be Use envariable AWK 2003-11-13 05:52:12 +00:00
lukem 130ab7336b Rework how MAKEVERBOSE operates:
*	Don't bother prefixing commands with a line of  ${_MKCMD}\
	and instead rely upon "make -s".  This is less intrusive on
	all the Makefiles than the former.  Idea from David Laight.

    *	Rename the variables use to print messages.  The scheme now is:
	    _MKMSG_FOO		Run  _MKMSG 'foo'
	    _MKTARGET_FOO	Run  _MKMSG_FOO ${.TARGET}
	From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00
christos 87b62b5af0 KNF:
- ansify
- no breaks after returns
- statics where needed
- no exit after errx
2003-10-19 07:34:38 +00:00
lukem a694177df5 support MAKEVERBOSE and use ${HOST_SH} 2003-10-19 04:25:00 +00:00
matt fe365eaf9d Fix printf botch 2003-09-20 22:24:00 +00:00
christos 73bb764e22 improve formatting in the non-siginfo case, by printing the code. This is
for compatibility with the old ktrace files.
2003-09-20 00:17:44 +00:00
christos b612016506 Print siginfo_t information when available. 2003-09-19 22:49:02 +00:00
thorpej e5adc13bea * Make it a little easier to add new "ioctl defns are in these files".
* Add the ability to decode the cryptodev ioctls.
2003-08-27 20:35:42 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
dsl fde07830ad Grok KTR_EXEC_ENV and KTR_EXEC_ARG.
Make ktrace -c default to removing all trace points (not just the default ones).
Make kdump default to dumping everything in the trace file.
Add 'A' (all) and '-' (remove following) to valid -t arguments.
Dump data block of UNKNOWN trace points in hex + ascii.
Make first time output with -R 0 (instead of time since epoch).
Use svis() instead of vis() to get " escaped (as \") (needs fixed libc)
Correctly pass unsigned values to svis()
Update man pages.
2003-07-17 09:05:11 +00:00
dsl a99fe675ab Change back to print hex bytes. The 'word' print was completely broken
on little endian systems.  It is also much easier to read misaligned
words in a straight byte hexdump.
Cut offset to 3 hex digits so that it fixs in 80 columns and still
leaves a tab at the start of 'continuation' lines.
The ktrace buffer is limited to 4k, so 3 digits is ample.
2003-07-13 18:54:29 +00:00
he ac678f8de2 On some ports, pointer differences are not ints, so do a cast
before using such a result as a field width.
2003-07-13 15:19:39 +00:00
manu cbfacd83b6 Make hexdump output fix in 80 char-wide terminal 2003-07-12 19:22:07 +00:00
manu e9383d7e5d Use the same code to display hexdump of GIO and MMSG (Mach Messages).
While we are there, display offsets in the hexdump, it can be useful.
Remove size display in Mach Messages as user processes don't always
fill it correctly.
2003-07-12 10:07:08 +00:00
wiz b712736290 Add -x to usage output. 2003-07-11 13:06:11 +00:00
wiz 79093334ef Bump date for -x addition. 2003-07-11 13:05:26 +00:00
dsl 6ea05bcbfe Add a '-x' option to display GIO data blocks in hex and ascii (instead of
vis(3) format).
Maybe there could be a heuristic to decide whether the data is printable...
2003-07-11 10:59:28 +00:00
fvdl 4fdb86c883 Back out previous. 2003-06-29 22:35:35 +00:00
martin 40ee31ef5e Since a caddr_t is (mis-)used as the lwp-id, cast it to intptr_t and use
apropriate format string.
2003-06-29 18:05:06 +00:00
darrenr d0ad455673 add appropriate hack to display ktr_buf as the lwpid if -L is supplied on
the command line.
2003-06-28 17:15:07 +00:00
mjl 91085f010d Add sys/sockio.h to needed includes for SIOCGIFASYNCMAP. 2003-06-24 11:27:50 +00:00
dsl d9380c052a Print rval[1] if non-zero and present in the trace entry.
To get both fd numbers for pipe().
2003-05-15 12:57:54 +00:00
christos b8dae40722 Don't invoke the grep for cleandir and obj targets. Suggested by
Juergen Hannken-Illjes
2003-04-18 14:43:49 +00:00
christos aa5b09ddbf PR/21117: Robert Elz: Makefile-ioctl.c mishandles dependencies 2003-04-13 05:04:00 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
atatat 9658e47b39 Make "-m0" print no data, so that we agree better with the man page. 2003-01-30 21:43:26 +00:00
manu 6492e2171f Added support for dumping mach messages in ktrace/kdump. While we are
there, KNFify a few functions.
2002-12-09 21:29:20 +00:00
wiz 287a8f7fb0 Sync usage with man page (and actual options). 2002-11-29 19:15:41 +00:00
wiz 75c991f87d Bump date for -N; sort options. 2002-11-29 19:14:00 +00:00
jdolecek d51c5abbd9 signame(): if sig == 0, return name " 0", so that the result would be
printed as:
   CALL  kill(0x1e4, SIG 0)
rathern than previous
   CALL  kill(0x1e4, SIG*unknown 0*)
2002-11-28 16:18:49 +00:00
atatat a19ac80340 Add -N which inhibits translation of system calls numbers into names. 2002-11-27 21:26:57 +00:00
manu bcffe04b31 Now properly display Mach traps 2002-11-15 19:58:05 +00:00
manu 0d50171c61 Added support for COMPAT_MACH 2002-10-29 07:17:43 +00:00
wiz 17cf386a88 Bump date for .Op Ar file addition. 2002-09-28 12:40:41 +00:00
atatat 76df260979 Allow passing of the ktrace file as the last argument without a -f. 2002-09-27 20:31:44 +00:00
lukem 2c16ea6f7e use NETBSDSRCDIR as appropriate 2002-09-19 11:31:21 +00:00
lha 35e64a7b76 remove extra $ from previous commit 2002-09-18 20:50:22 +00:00