]> sourceware.org Git - valgrind.git/commitdiff
Bug 449309 - Missing loopback device ioctl(s)
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 5 Mar 2023 07:38:34 +0000 (08:38 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 5 Mar 2023 07:42:42 +0000 (08:42 +0100)
Patch provided by:
    Faheem Sheikh <faheem.sheikh@bmw.de>

Note that the testcase provided with this report hasn't
been added as it requires privileges.

NEWS
coregrind/m_syswrap/syswrap-linux.c
include/vki/vki-linux.h

diff --git a/NEWS b/NEWS
index e31fc3c50d4e2e04ce512e1ec28485693833fcef..61c4e03053bb681c079f5c55ff5645ea9509042c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -89,6 +89,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 444568  drd/tests/pth_barrier_thr_cr fails on Fedora 38
 445743  "The impossible happened: mutex is locked simultaneously by two threads"
         while using mutexes with priority inheritance and signals
+449309  Missing loopback device ioctl(s) 
 459476  vgdb: allow address reuse to avoid "address already in use" errorsuse" errors
 460356  s390: Sqrt32Fx4 -- cannot reduce tree
 462830  WARNING: unhandled amd64-freebsd syscall: 474
index 4a5a93b35a2f5ed8a00c812f3783410a586489bc..34d4cf1f55408e6ebcfa3d7c642366adcba54b01 100644 (file)
@@ -7861,6 +7861,32 @@ PRE(sys_ioctl)
       PRE_MEM_WRITE( "ioctl(RTC_IRQP_READ)", ARG3, sizeof(unsigned long));
       break;
 
+      /* Loopback control */
+   case VKI_LOOP_CTL_ADD:
+   case VKI_LOOP_CTL_REMOVE:
+   case VKI_LOOP_CTL_GET_FREE:
+      break;
+      /* Loopback device */
+   case VKI_LOOP_SET_FD:
+   case VKI_LOOP_CLR_FD:
+   case VKI_LOOP_CHANGE_FD:
+   case VKI_LOOP_SET_CAPACITY:
+   case VKI_LOOP_SET_DIRECT_IO:
+   case VKI_LOOP_SET_BLOCK_SIZE:
+      break;
+   case VKI_LOOP_SET_STATUS:
+      PRE_MEM_READ("ioctl(LOOP_SET_STATUS)", ARG3, sizeof(struct vki_loop_info));
+      break;
+   case VKI_LOOP_GET_STATUS:
+      PRE_MEM_WRITE("ioctl(LOOP_GET_STATUS)", ARG3, sizeof(struct vki_loop_info));
+      break;
+   case VKI_LOOP_SET_STATUS64:
+      PRE_MEM_READ("ioctl(LOOP_SET_STATUS64)", ARG3, sizeof(struct vki_loop_info64));
+      break;
+   case VKI_LOOP_GET_STATUS64:
+      PRE_MEM_WRITE("ioctl(LOOP_GET_STATUS64)", ARG3, sizeof(struct vki_loop_info64));
+      break;
+
       /* Block devices */
    case VKI_BLKROSET:
       PRE_MEM_READ( "ioctl(BLKROSET)", ARG3, sizeof(int));
@@ -10828,6 +10854,33 @@ POST(sys_ioctl)
       POST_MEM_WRITE(ARG3, sizeof(unsigned long));
       break;
 
+   /* Loopback devices */
+   case VKI_LOOP_CTL_ADD:
+   case VKI_LOOP_CTL_REMOVE:
+   case VKI_LOOP_CTL_GET_FREE:
+      break;
+      /* Loopback device */
+   case VKI_LOOP_SET_FD:
+   case VKI_LOOP_CLR_FD:
+   case VKI_LOOP_CHANGE_FD:
+   case VKI_LOOP_SET_CAPACITY:
+   case VKI_LOOP_SET_DIRECT_IO:
+   case VKI_LOOP_SET_BLOCK_SIZE:
+      break;
+   case VKI_LOOP_SET_STATUS:
+      POST_MEM_WRITE(ARG3, sizeof(struct vki_loop_info));
+      break;
+   case VKI_LOOP_GET_STATUS:
+      POST_MEM_WRITE(ARG3, sizeof(struct vki_loop_info));
+      break;
+   case VKI_LOOP_SET_STATUS64:
+      POST_MEM_WRITE(ARG3, sizeof(struct vki_loop_info64));
+      break;
+   case VKI_LOOP_GET_STATUS64:
+      POST_MEM_WRITE(ARG3, sizeof(struct vki_loop_info64));
+      break;
+
+
       /* Block devices */
    case VKI_BLKROSET:
       break;
index c9638370152fd0feba52e2b8f074c779dff307a7..be3d76690ceecee92c96bc9db9bafd7387cc98cf 100644 (file)
@@ -1872,6 +1872,62 @@ struct vki_ppdev_frob_struct {
 #define VKI_PPGETFLAGS _VKI_IOR(VKI_PP_IOCTL, 0x9a, int)
 #define VKI_PPSETFLAGS _VKI_IOW(VKI_PP_IOCTL, 0x9b, int)
 
+//----------------------------------------------------------------------
+// From linux-5.2.5/include/uapi/linux/loop.h
+//----------------------------------------------------------------------
+
+#define                VKI_LO_NAME_SIZE                64
+#define                VKI_LO_KEY_SIZE                 32
+
+struct vki_loop_info {
+
+       int                 lo_number;              /* ioctl r/o */
+       unsigned short      lo_device;              /* ioctl r/o */
+       unsigned long       lo_inode;               /* ioctl r/o */
+       unsigned short      lo_rdevice;             /* ioctl r/o */
+       int                 lo_offset;
+       int                 lo_encrypt_type;
+       int                 lo_encrypt_key_size;    /* ioctl w/o */
+       int                 lo_flags;               /* ioctl r/o */
+       char                lo_name[VKI_LO_NAME_SIZE];
+       unsigned char       lo_encrypt_key[VKI_LO_KEY_SIZE];/* ioctl w/o */
+       unsigned long       lo_init[2];
+       char                reserved[4];
+};
+
+struct vki_loop_info64 {
+       __vki_u64          lo_device;           /* ioctl r/o */
+       __vki_u64          lo_inode;            /* ioctl r/o */
+       __vki_u64          lo_rdevice;          /* ioctl r/o */
+       __vki_u64          lo_offset;
+       __vki_u64          lo_sizelimit;/* bytes, 0 == max available */
+       __vki_u32          lo_number;           /* ioctl r/o */
+       __vki_u32          lo_encrypt_type;
+       __vki_u32          lo_encrypt_key_size; /* ioctl w/o */
+       __vki_u32          lo_flags;            /* ioctl r/o */
+       __vki_u8           lo_file_name[VKI_LO_NAME_SIZE];
+       __vki_u8           lo_crypt_name[VKI_LO_NAME_SIZE];
+       __vki_u8           lo_encrypt_key[VKI_LO_KEY_SIZE]; /* ioctl w/o */
+       __vki_u64          lo_init[2];
+};
+
+/* loopback device related, e.g. see losetup program options */
+#define VKI_LOOP_SET_FD         0x4C00
+#define VKI_LOOP_CLR_FD         0x4C01
+#define VKI_LOOP_SET_STATUS     0x4C02
+#define VKI_LOOP_GET_STATUS     0x4C03
+#define VKI_LOOP_SET_STATUS64   0x4C04
+#define VKI_LOOP_GET_STATUS64   0x4C05
+#define VKI_LOOP_CHANGE_FD      0x4C06
+#define VKI_LOOP_SET_CAPACITY   0x4C07
+#define VKI_LOOP_SET_DIRECT_IO  0x4C08
+#define VKI_LOOP_SET_BLOCK_SIZE 0x4C09
+
+/* ioctls for loop-control device interface */
+#define VKI_LOOP_CTL_ADD        0x4C80 // adds a new loopback device
+#define VKI_LOOP_CTL_REMOVE     0x4C81 // deletes an existing loopback device
+#define VKI_LOOP_CTL_GET_FREE   0x4C82 // finds a free/available loopback device
+
 //----------------------------------------------------------------------
 // From linux-5.2.5/include/uapi/linux/fs.h
 //----------------------------------------------------------------------
This page took 0.061601 seconds and 5 git commands to generate.