From 453dee05490357d691c2003398e8c734ec49f23b Mon Sep 17 00:00:00 2001 From: Ulrich Hecht Date: Mon, 8 Jan 2024 07:00:43 +0100 Subject: [PATCH] libc_server: make 64-bit safe If we run on a 64-bit Linux kernel, we will have to replace 32-bit pointers with 64-bit pointers. Make param_t always 64 bits, then the payload doesn't need to care if that is the case or not. --- libc_server.c | 2 +- libc_server.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/libc_server.c b/libc_server.c index c6407f4..e3b4a9c 100644 --- a/libc_server.c +++ b/libc_server.c @@ -46,7 +46,7 @@ struct newlib_stat { /* uid_t */ unsigned short st_uid; /* gid_t */ unsigned short st_gid; /* dev_t */ unsigned short st_rdev; - /* off_t */ long st_size; + /* off_t */ int32_t st_size; }; struct newlib_timeval { diff --git a/libc_server.h b/libc_server.h index 5041659..794f50b 100644 --- a/libc_server.h +++ b/libc_server.h @@ -8,13 +8,7 @@ #error INT_MAX/LONG_MAX not defined #endif -// Find a data type that fits both pointers and integers. - -#if INT_MAX == LONG_MAX -typedef uint32_t param_t; -#else typedef uint64_t param_t; -#endif enum libc_funcs { LIBC_WRITE,