* [PATCH] linux-user: Protect btrfs ioctl target definitions
@ 2020-09-05 16:38 Filip Bozuta
2020-09-05 21:08 ` Laurent Vivier
2020-09-05 21:09 ` Laurent Vivier
0 siblings, 2 replies; 3+ messages in thread
From: Filip Bozuta @ 2020-09-05 16:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
Target definitions of btrfs ioctls in 'syscall_defs.h' use
the value BTRFS_IOCTL_MAGIC that is defined header 'btrfs.h'.
This header is not available in kernel versions before 3.9.
For that reason, these target ioctl definitions should be
enwrapped in an #ifdef directive to check whether the 'btrfs.h'
header is available as to not cause build errors on older
Linux systems.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
---
linux-user/syscall_defs.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 33a414c50f..731c3d5341 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1006,6 +1006,7 @@ struct target_rtc_pll_info {
#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
/* btrfs ioctls */
+#ifdef CONFIG_BTRFS
#define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
#define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
#define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
@@ -1041,6 +1042,7 @@ struct target_rtc_pll_info {
#define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60)
#define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61)
#define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62)
+#endif
/* usb ioctls */
#define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Protect btrfs ioctl target definitions
2020-09-05 16:38 [PATCH] linux-user: Protect btrfs ioctl target definitions Filip Bozuta
@ 2020-09-05 21:08 ` Laurent Vivier
2020-09-05 21:09 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2020-09-05 21:08 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 05/09/2020 à 18:38, Filip Bozuta a écrit :
> Target definitions of btrfs ioctls in 'syscall_defs.h' use
> the value BTRFS_IOCTL_MAGIC that is defined header 'btrfs.h'.
> This header is not available in kernel versions before 3.9.
> For that reason, these target ioctl definitions should be
> enwrapped in an #ifdef directive to check whether the 'btrfs.h'
> header is available as to not cause build errors on older
> Linux systems.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/syscall_defs.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 33a414c50f..731c3d5341 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1006,6 +1006,7 @@ struct target_rtc_pll_info {
> #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
>
> /* btrfs ioctls */
> +#ifdef CONFIG_BTRFS
> #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
> #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
> #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
> @@ -1041,6 +1042,7 @@ struct target_rtc_pll_info {
> #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60)
> #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61)
> #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62)
> +#endif
>
> /* usb ioctls */
> #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Protect btrfs ioctl target definitions
2020-09-05 16:38 [PATCH] linux-user: Protect btrfs ioctl target definitions Filip Bozuta
2020-09-05 21:08 ` Laurent Vivier
@ 2020-09-05 21:09 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2020-09-05 21:09 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 05/09/2020 à 18:38, Filip Bozuta a écrit :
> Target definitions of btrfs ioctls in 'syscall_defs.h' use
> the value BTRFS_IOCTL_MAGIC that is defined header 'btrfs.h'.
> This header is not available in kernel versions before 3.9.
> For that reason, these target ioctl definitions should be
> enwrapped in an #ifdef directive to check whether the 'btrfs.h'
> header is available as to not cause build errors on older
> Linux systems.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/syscall_defs.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 33a414c50f..731c3d5341 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1006,6 +1006,7 @@ struct target_rtc_pll_info {
> #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
>
> /* btrfs ioctls */
> +#ifdef CONFIG_BTRFS
> #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
> #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
> #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
> @@ -1041,6 +1042,7 @@ struct target_rtc_pll_info {
> #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60)
> #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61)
> #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62)
> +#endif
>
> /* usb ioctls */
> #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
>
Applied to my linux-user-for-5.2 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-05 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05 16:38 [PATCH] linux-user: Protect btrfs ioctl target definitions Filip Bozuta
2020-09-05 21:08 ` Laurent Vivier
2020-09-05 21:09 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.