Commit Graph

33 Commits

Author SHA1 Message Date
Nicholas Nethercote
136a5e69d5 This commit fixes up the handling of shadow registers quite a bit.
Removed the SK_(written_shadow_regs_values)() function.  Instead, skins that
use shadow regs can track the `post_regs_write_init' event, and set the shadow
regs from within it.  This is much more flexible, since it allows each shadow
register to be set to a separate value if necessary.  It also matches the new
shadow-reg-change events described below.

In the core, there were some places where the shadow regs were changed, and
skins had no way of knowing about it, which was a problem for some skins.
So I added a bunch of new events to notify skins about these:

  post_reg_write_syscall_return
  post_reg_write_deliver_signal
  post_reg_write_pthread_return
  post_reg_write_clientreq_return
  post_reg_write_clientcall_return

Any skin that uses shadow regs should almost certainly track these events.  The
post_reg_write_clientcall_return allows a skin to tailor the shadow reg of the
return value of a CLIENTCALL'd function appropriately;  this is especially
useful when replacing malloc() et al.

Defined some macros that should be used *whenever the core changes the value of
a shadow register* :

  SET_SYSCALL_RETVAL
  SET_SIGNAL_EDX          (maybe should be SET_SIGNAL_RETVAL? ... not sure)
  SET_SIGNAL_ESP
  SET_CLREQ_RETVAL
  SET_CLCALL_RETVAL
  SET_PTHREQ_ESP
  SET_PTHREQ_RETVAL

These replace all the old SET_EAX and SET_EDX macros, and are added in a few
places where the shadow-reg update was missing.

Added shadow registers to the machine state saved/restored when signal handlers
are pushed/popped (they were missing).

Added skin-callable functions VG_(set_return_from_syscall_shadow)() and
VG_(get_exit_status_shadow)() which are useful and abstract away from which
registers the results are in.

Also, poll() changes %ebx (it's first argument) sometimes, I don't know why.
So we notify skins about that too (with the `post_reg_write_syscall_return'
event, which isn't ideal I guess...)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1642
2003-05-19 15:04:06 +00:00
Julian Seward
07258f73de gcc-3.3 as supplied with SuSE 8.2 ("gcc version 3.3 20030226
(prerelease) (SuSE Linux)") seems to complain about signed-vs-unsigned
comparisons, when -Wall is on.  This commit fixes (most of) those
complaints.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1638
2003-05-18 10:05:38 +00:00
Nicholas Nethercote
8c12eaeb63 Minor fix for lookup_dcookie
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1580
2003-05-02 16:18:06 +00:00
Nicholas Nethercote
694c3ee614 Fixed some syscalls a little bit:
- getcwd() now uses the result for the post_mem_write length rather than
   the argument, which would have over-estimated

 - accept(), recvfrom() and getsockopt() can now all take NULL buffers (which
   are quite legitimate) without Memcheck giving spurious errors

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1579
2003-05-02 16:00:34 +00:00
Julian Seward
284654f749 Add __NR_prctl.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1569
2003-04-26 22:55:12 +00:00
Julian Seward
a6194ccaea Add __NR_lookup_dcookie, whatever that might be.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1563
2003-04-26 21:46:16 +00:00
Nicholas Nethercote
4f1b2c3adc Added syscall creat(), courtesy of Tom Hughes <thh@cyberscience.com>.
Weird that it's never come up before, everyone must use open() in preference.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1555
2003-04-24 18:14:11 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Julian Seward
f400903bd3 Support __NR_munlockall (syscall 151).
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1504
2003-04-03 22:35:01 +00:00
Julian Seward
575a8896ec o I fixed a small bug: the code in coregrind/vg_syscalls.c seems
to assume that all sockaddrs are non-NULL and non-zero in
     length.  This isn't always true, and when I ran a program that
     used a NULL sockaddr through Valgrind it segfaulted.  I believe
     that the change that I made fixes this bug in general, but I
     might be overlooking something.

From kclark@CetaceanNetworks.com (Kevin D. Clark)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1440
2003-02-24 21:55:34 +00:00
Julian Seward
9065d62ecc Hopefully deal with system 252 (__NR_exit_group) correctly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1427
2003-02-23 03:26:08 +00:00
Nicholas Nethercote
3e0ad40f18 Changed comments only: added a couple of missing syscall numbers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1421
2003-02-19 11:39:02 +00:00
Nicholas Nethercote
a3862bfb1b Ugh, fixed it properly this time.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1417
2003-02-05 22:08:58 +00:00
Nicholas Nethercote
6d6d33c360 Fixed comment typo.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1416
2003-02-05 22:06:48 +00:00
Julian Seward
1efa0352a6 Add syscall 185 (__NR_capset). From Gerald Carter <jerry@samba.org>.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1403
2003-01-05 12:35:19 +00:00
Julian Seward
3a71cb3483 Only complain three times about unhandled ioctls, then shut up. Stops
it complaining endlessly when running kscd.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1402
2003-01-05 12:19:35 +00:00
Julian Seward
d24ad352a6 Add (bogus) support for ioctls CDROM_DRIVE_STATUS and CDROM_CLEAR_OPTIONS.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1323
2002-11-17 02:50:17 +00:00
Julian Seward
4508b0dec4 (whitespace change only) -- break some long lines
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1322
2002-11-17 02:46:19 +00:00
Julian Seward
7240057bc8 Merge patch from Jeremy Fitzhardinge:
14-hg-mmap-magic-virgin
  This does two things:

  1. change the signatures of the new_mem_mmap and change_mem_mprotect
  functions to remove the pointless 'nn' argument. This makes them match
  the signature of new_mem_startup...

  2. change helgrind to mark memory created by mmap as if it were the
  same as other magically pre-inited memory. Implement this by pointing
  helgrind's new_mem_mmap function at new_mem_startup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1263
2002-10-23 21:46:13 +00:00
Julian Seward
277bf259c6 Merge patch from Jeremy Fitzhardinge:
20-hg-secmap
  HELGRIND: fix bugs causing a torrent of "access to distingished map"
  messages. There were two: one is some absurdly broken rounding/padding
  code in set_address_range_state() (how did anything work!?). The other
  was some odd looking code in the tracking of attaching shared memory
  segments. Since they're semantically very similar to mmap, track them
  as such.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1257
2002-10-22 05:05:49 +00:00
Julian Seward
a2174b135a merge (in effect, and without docs) revs:
valgrind.in       1.17.2.3
   vg_syscall_mem.c 1.58.2.12

Add Jeremy Fitzhardinge's --weird-hacks=lax-ioctls patch, and add some docs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1244
2002-10-20 18:11:49 +00:00
Julian Seward
3a80785b70 merge rev 1.68.2.11:
Add ever more new ioctls and syscalls.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1239
2002-10-16 23:13:00 +00:00
Julian Seward
7856fb224e modify_ldt nano-wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1194
2002-10-05 15:23:17 +00:00
Julian Seward
7e71cd0997 __NR_modify_ldt: func=0x11 is also a kind of write
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1193
2002-10-05 15:22:29 +00:00
Julian Seward
5e6bec250e merge revs
vg_syscall_mem.c 1.58.2.8 and 1.58.2.10
   vg_unsafe.h 1.8.4.2

Support for __NR_ptrace, thanks to Jason Molenda.  Now valgrind can be
used to debug GDB.  Bwaha!

Kludge to work around the problem that the /usr/include/sys/user.h on
R H 6.2 doesn't define struct user_fpxregs_struct (problem appeared
with Jason Molenda's ptrace patch).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1192
2002-10-05 15:18:27 +00:00
Julian Seward
ae1bdb53f7 merge rev 1.58.2.9:
Support __NR_mount and __NR_umount.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1191
2002-10-05 15:00:06 +00:00
Julian Seward
a4b942d399 merge rev 1.58.2.7:
Implement __NR_setresgid (170).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1190
2002-10-05 14:52:27 +00:00
Julian Seward
9d873be7dd merge rev 1.58.2.5:
Implement TIOCLINUX (from Pavel Roskin <proski@gnu.org>).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1189
2002-10-05 14:49:29 +00:00
Nicholas Nethercote
089e7e3bcb Updated file descriptions in the copyright notices to reflect the core/skin
split.  Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166
2002-10-02 13:26:35 +00:00
Nicholas Nethercote
41a0bcbbbb Changes made so that skin error "report this bug to" messages are distinguished
from core error ones:

  - Split up VG_(panic) into VG_(core_panic) and VG_(skin_panic)

  - Likewise, split vg_assert into vg_assert and sk_assert

  - Added a new need string: `bug_reports_to'

  - Removed VG_(skin_error) which was a previous wussy attempt at this change.
    This removed the need for the hacky redeclaration of VG_(skin_error) in
    vg_profile.c, which is good.

At the moment, Julian and Nick's email addresses are hard-coded into each skin
individually, rather than using a #define in vg_skin.h, because that didn't
feel quite right to me...  jseward@acm.org is still done with a #define for
core errors, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1164
2002-10-02 11:08:25 +00:00
Julian Seward
ba23994713 Namespace police.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1150
2002-10-01 00:50:47 +00:00
Julian Seward
e5159f48cc First half of the long-overdue support for segment override prefixes,
LDTs and __NR_modify_ldt.

- Each thread has its own LDT.  Usually NULL, but if we need to
  change an entry, it is allocated.  LDTs are inherited from parents
  as one would expect.

- We intercept __NR_modify_ldt and update the calling thread's LDT
  accordingly.  This is done in coregrind/vg_ldt.c.  The kernel
  never sees these syscalls.

- New architectural state for %cs, %ss, %ds, %es, %fs and %gs.
  Probably overkill including %cs and %ss.  These are saved and
  restored in the usual way, _except_ at syscalls -- there's no
  point, since we are hiding all LDT operations from the kernel now.
  This does assume that no syscall implicitly looks at the
  segment registers, but I think that's safe.

Still only halfway there.  JITter is still unaware of seg regs
and override prefixes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1133
2002-09-30 00:53:10 +00:00
Nicholas Nethercote
afebe61b37 Files updated, added and removed in order to turn the ERASER branch into HEAD
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086
2002-09-23 09:36:25 +00:00