mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 02:46:49 +07:00
53bb724f94
After a bit of poking around wondering why my 32-bit user-space can't seem to send a proper ioctl(BLKPG) to an MTD on my 64-bit kernel (ARM64), I noticed that struct blkpg_ioctl_arg is actually pretty unsuitable for use in the ioctl() ABI, due to its use of raw pointers, and its lack of alignment/packing restrictions (32-bit arch'es tend to pack the 4 fields into 4 32-bit words, whereas 64-bit arch'es would add padding after the third int, and make this 6 32-bit words). Anyway, this means BLKPG deserves some special compat_ioctl handling. Do the conversion in a small shim for MTD. block/compat_ioctl.c already has compat support for the block subsystem, but it does so by a re-marshalling data to/from user-space (see compat_blkpg_ioctl()). Personally, I think this approach is cleaner. Tested only on MTD, with an ARM32 user space on an ARM64 kernel. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
22 lines
397 B
C
22 lines
397 B
C
#ifndef _LINUX_BLKPG_H
|
|
#define _LINUX_BLKPG_H
|
|
|
|
/*
|
|
* Partition table and disk geometry handling
|
|
*/
|
|
|
|
#include <linux/compat.h>
|
|
#include <uapi/linux/blkpg.h>
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
/* For 32-bit/64-bit compatibility of struct blkpg_ioctl_arg */
|
|
struct blkpg_compat_ioctl_arg {
|
|
compat_int_t op;
|
|
compat_int_t flags;
|
|
compat_int_t datalen;
|
|
compat_uptr_t data;
|
|
};
|
|
#endif
|
|
|
|
#endif /* _LINUX_BLKPG_H */
|