* mem.c: Move "define sys_mmap64 sys_mmap" from the top
to the only place it affects.
(print_mmap): Make offset argument unsigned, for safer implicit conversions.
(sys_old_mmap): [IA64] use unsigned narrow_arg[].
Cast u_arg[5] (offset param) to unsigned long, to prevent erroneous signed
expansion.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
# include <asm/page.h> /* for PAGE_SHIFT */
#endif
# include <asm/page.h> /* for PAGE_SHIFT */
#endif
-#ifdef HAVE_LONG_LONG_OFF_T
-/*
- * Ugly hacks for systems that have a long long off_t
- */
-# define sys_mmap64 sys_mmap
-#endif
-
int
sys_brk(struct tcb *tcp)
{
int
sys_brk(struct tcb *tcp)
{
#if !HAVE_LONG_LONG_OFF_T
static int
#if !HAVE_LONG_LONG_OFF_T
static int
-print_mmap(struct tcb *tcp, long *u_arg, long long offset)
+print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
{
if (entering(tcp)) {
/* addr */
{
if (entering(tcp)) {
/* addr */
/* flags */
#ifdef MAP_TYPE
printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
/* flags */
#ifdef MAP_TYPE
printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
addflags(mmap_flags, addtileflags(u_arg[3] & ~MAP_TYPE));
addflags(mmap_flags, addtileflags(u_arg[3] & ~MAP_TYPE));
addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
#else
printflags(mmap_flags, u_arg[3], "MAP_???");
#endif
#else
printflags(mmap_flags, u_arg[3], "MAP_???");
#endif
printfd(tcp, u_arg[4]);
/* offset */
tprintf(", %#llx", offset);
printfd(tcp, u_arg[4]);
/* offset */
tprintf(", %#llx", offset);
* new `sys_mmap' interface.
* For IA32 processes, this code converts the integer arguments
* that they pushed onto the stack, into longs.
* new `sys_mmap' interface.
* For IA32 processes, this code converts the integer arguments
* that they pushed onto the stack, into longs.
- *
- * Note that addresses with bit 31 set will be sign extended.
- * Fortunately, those addresses are not currently being generated
- * for IA32 processes so it's not a problem.
+ unsigned narrow_arg[6];
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
return 0;
for (i = 0; i < 6; i++)
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
return 0;
for (i = 0; i < 6; i++)
#elif defined(SH) || defined(SH64)
/* SH has always passed the args in registers */
long *u_arg = tcp->u_arg;
#elif defined(SH) || defined(SH64)
/* SH has always passed the args in registers */
long *u_arg = tcp->u_arg;
if (current_personality == 1) {
int i;
unsigned narrow_arg[6];
if (current_personality == 1) {
int i;
unsigned narrow_arg[6];
return 0;
for (i = 0; i < 6; ++i)
u_arg[i] = narrow_arg[i];
return 0;
for (i = 0; i < 6; ++i)
u_arg[i] = narrow_arg[i];
+ } else {
+ if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
+ return 0;
if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
return 0;
if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
return 0;
-#endif /* other architectures */
-
- return print_mmap(tcp, u_arg, u_arg[5]);
+#endif
+ return print_mmap(tcp, u_arg, (unsigned long)u_arg[5]);
* From code it seems that it might use 7 or 8 registers,
* which is strange - Linux syscalls can pass maximum of 6 parameters!
*/
* From code it seems that it might use 7 or 8 registers,
* which is strange - Linux syscalls can pass maximum of 6 parameters!
*/
+# ifdef HAVE_LONG_LONG_OFF_T
+/* For systems that have a long long off_t,
+ * sys_mmap in syscall tables is handled by sys_mmap64:
+ */
+# define sys_mmap64 sys_mmap
+# endif
int
sys_mmap64(struct tcb *tcp)
{
int
sys_mmap64(struct tcb *tcp)
{