ASHMEM_GET_FILE_ID is defined as taking a pointer to an unsigned long as
an input parameter. This is unfortunate, as the size of an unsigned long
is different across 64 and 32-bit programs, and consequently so is the
definition of the ioctl command.
So, when invoked from a process executing a 32-bit program on a 64-bit
kernel, the ioctl command is not recognized. Therefore, define the 32-bit
version of ASHMEM_GET_FILE_ID and handle it accordingly.
While we're here, fix the ashmem-memfd handler so that it returns ENOTTY
when an unknown ioctl command is used.
Bug: 502308977
Fixes: 80fcf382d1af ("ANDROID: Add ashmem ioctl to return a unique file identifier")
[isaacmanjarres: resolved trivial merge conflicts in
rust helpers and updated UserSlice creation to use UserPtr.]
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
Cherrypick-From: https://android-review.googlesource.com/q/commit:d8ebfa28662f94b45b81beaad2333599df256777
Merged-In: I016b86218c43fa808215342eac85591cc037de9b
Change-Id: I016b86218c43fa808215342eac85591cc037de9b
11 lines
192 B
C
11 lines
192 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/compat.h>
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
__rust_helper void __user *rust_helper_compat_ptr(compat_uptr_t uptr)
|
|
{
|
|
return compat_ptr(uptr);
|
|
}
|
|
#endif
|