[PATCH] Fix {get, set}rlimit decoding with unreliable SIZEOF_RLIM_T

James Hogan james.hogan at imgtec.com
Wed May 14 12:08:16 UTC 2014


On 02/05/14 14:15, James Hogan wrote:
> When strace is built with large file support definitions in CFLAGS (as
> may be provided by buildroot) the C library headers may expose a 64-bit
> rlim_t even though the struct rlimit fields used by the system call
> interface are only 32-bit. The SIZEOF_RLIM_T will then be 8 which
> results in bad decoding of the getrlimit and setrlimit syscalls.
> 
> This is fixed by removing the "#if SIZEOF_RLIM_T == 4 ||
> SUPPORTED_PERSONALITIES > 1" conditional, since the remaining code
> already handles multiple personalities based on the value of
> current_wordsize, which is set correctly even for a single personality.
> 
> Signed-off-by: James Hogan <james.hogan at imgtec.com>

Hi, does this patch look okay?

Thanks
James

> ---
>  resource.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/resource.c b/resource.c
> index 5f92b39..b191ec2 100644
> --- a/resource.c
> +++ b/resource.c
> @@ -135,8 +135,6 @@ decode_rlimit64(struct tcb *tcp, unsigned long addr)
>  		print_rlimit64(tcp, addr);
>  }
>  
> -#if SIZEOF_RLIM_T == 4 || SUPPORTED_PERSONALITIES > 1
> -
>  static const char *
>  sprint_rlim32(uint32_t lim)
>  {
> @@ -187,12 +185,6 @@ decode_rlimit(struct tcb *tcp, unsigned long addr)
>  	}
>  }
>  
> -#else /* SIZEOF_RLIM_T == 8 && SUPPORTED_PERSONALITIES == 1 */
> -
> -# define decode_rlimit decode_rlimit64
> -
> -#endif /* SIZEOF_RLIM_T == 4 || SUPPORTED_PERSONALITIES > 1 */
> -
>  int
>  sys_getrlimit(struct tcb *tcp)
>  {
> 




More information about the Strace-devel mailing list