fix 123837 semctl system call: 4rth argument is optional, depending on cmd

Depending on the semctl command (arg3), arg4 might or might not be needed.
The PRE(sys_ipc) multiplexed syscall for semctl was always checking
all 4 args.

The fix consists in dereferencing the 4th arg (which in sys_ipc is ARG5)
only if the semctl syscall cmd implies 4 arguments.
This avoids the false positive on linux x86.

Note that PRE(sys_ipc) is still too simplistic as it assumes
that 6 args are always read, which is not the case.
This seems to cause false positive on mips:
  memcheck on none/tests/sem gives:
     Syscall param ipc(fifth) contains uninitialised byte(s)

It would be nice to implement the multiplexed PRE(sys_ipc) by
calling the PRE(sys_xxxx) similar PRE, depending on ARG1 of sys_ipc.
This would then avoid the simplistic PRE(sys_ipc) logic without duplicating
the logic in PRE(sys_semctl) (and all other sys_ipc multiplexed syscalls).
However, I found no easy way to do that.

With the current fix, some logic about semctl is partially duplicated between
the PRE(sys_ipc) (for platforms such as x86 having a multiplexed sys call)
and PRE(sys_semctl) (for platforms such as amd64, having a direct sys call)
to fix the false positive encountered on x86.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13082 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index a99c178..825f77e 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@
 [381] = fixed in trunk and in 3_8_BRANCH, for 3.8.1
 [382] = fixed in trunk and needs to be made available for 3.8.2 too
 
+123837    [390] semctl system call: 4rth argument is optional, depending on cmd
 252955    [390] Impossible to compile with ccache
 274695    [390] s390x: Support "compare to/from logical" instructions (z196)
 275800    [390] s390x: Add support for the ecag instruction (part 1)