From: Julian Seward Date: Sun, 23 Nov 2014 17:55:13 +0000 (+0000) Subject: Merge, from trunk, r14689 X-Git-Tag: svn/VALGRIND_3_10_1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a2e3976d91924cd23291b22ba47713247d7f421;p=thirdparty%2Fvalgrind.git Merge, from trunk, r14689 14689 PRE(sys_openat): when checking whether ARG1 == VKI_AT_FDCWD [..] git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_10_BRANCH@14766 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e36036f21a..37932814ad 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4372,10 +4372,11 @@ PRE(sys_openat) PRE_MEM_RASCIIZ( "openat(filename)", ARG2 ); /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, - filename is relative to cwd. */ + filename is relative to cwd. When comparing dfd against AT_FDCWD, + be sure only to compare the bottom 32 bits. */ if (ML_(safe_to_deref)( (void*)ARG2, 1 ) && *(Char *)ARG2 != '/' - && ARG1 != VKI_AT_FDCWD + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) && !ML_(fd_allowed)(ARG1, "openat", tid, False)) SET_STATUS_Failure( VKI_EBADF );