[PATCH] fix open flag decoding on 32-bit Android

Dmitry V. Levin ldv at altlinux.org
Fri Oct 3 23:09:32 UTC 2014


On Tue, Sep 23, 2014 at 07:09:50PM -0700, enh wrote:
> commit d2bed27b663096f8771df824a85f3815a0c7d7da
> Author: Elliott Hughes <enh at google.com>
> Date:   Tue Sep 23 18:49:19 2014 -0700
> 
>     Don't risk truncating open flags by using mode_t.
> 
>     On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
>     as their mode_t. The open(2) flags are actually an int, so high ones
>     like O_CLOEXEC get truncated if you coerce them to mode_t.
> 
>     Signed-off-by: Elliott Hughes <enh at google.com>
> 
> diff --git a/defs.h b/defs.h
> index cd9817b..5bfeb6b 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -708,8 +708,8 @@ extern void print_sigset_addr_len(struct tcb *, long, long);
>  extern void printsignal(int);
>  extern void tprint_iov(struct tcb *, unsigned long, unsigned long,
> int decode_iov);
>  extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned
> long, int decode_iov, unsigned long);

Your patch failed to apply because of these two wrapped lines,
and I forgot about it afterwards.

> -extern void tprint_open_modes(mode_t);
> -extern const char *sprint_open_modes(mode_t);
> +extern void tprint_open_modes(int);
> +extern const char *sprint_open_modes(int);

Thanks, it certainly should be int.  Apparently, it's my bug
(v4.5.14-52-g9b5b67e), I must have confused types of 2nd and
3rd arguments of open(2).


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20141004/febf55ea/attachment.bin>


More information about the Strace-devel mailing list