Fix the casting issue
Gaurav Singh [Wed, 25 May 2016 12:45:10 +0000 (17:45 +0530)]
Allow a 64 bit pointer to be cast and put into a
32-bit integer, when that pointer points to a
location within a 32 bit userspace.

Normally this is a very bad thing to do, the compiler
is right to warn us about this, but in this very
specific case, it is OK.

In file included from fs/compat_binfmt_elf.c:128:0:
fs/binfmt_elf.c: In function 'create_elf_tables':
/cuba/jak/tegra/r23.1/a/arch/arm64/include/asm/elf.h:143:7:
warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]
(elf_addr_t)current->mm->context.vdso);

fs/binfmt_elf.c:216:26: note:
in definition of macro 'NEW_AUX_ENT'
elf_info[ei_index++] = val;

fs/binfmt_elf.c:226:2: note:
in expansion of macro 'ARCH_DLINFO'
ARCH_DLINFO;

Bug 200187768

Change-Id: Ia9086a0b43c608e672d04cec209ea7edc1d3a806
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Gaurav Singh <gaursingh@nvidia.com>
Reviewed-on: http://git-master/r/1163935
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

arch/arm64/include/asm/elf.h

index 5469b9f..ec18068 100644 (file)
@@ -140,7 +140,7 @@ extern unsigned long randomize_et_dyn(unsigned long base);
 #define ARCH_DLINFO                                                    \
 do {                                                                   \
        NEW_AUX_ENT(AT_SYSINFO_EHDR,                                    \
-                   (elf_addr_t)current->mm->context.vdso);             \
+                   (elf_addr_t)(long)current->mm->context.vdso);       \
 } while (0)
 
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES