kcov: fix struct layout for kcov_remote_arg
authorAndrey Konovalov <andreyknvl@google.com>
Sat, 4 Jan 2020 20:59:39 +0000 (12:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Jan 2020 21:55:09 +0000 (13:55 -0800)
Make the layout of kcov_remote_arg the same for 32-bit and 64-bit code.
This makes it more convenient to write userspace apps that can be
compiled into 32-bit or 64-bit binaries and still work with the same
64-bit kernel.

Also use proper __u32 types in uapi headers instead of unsigned ints.

Link: http://lkml.kernel.org/r/9e91020876029cfefc9211ff747685eba9536426.1575638983.git.andreyknvl@google.com
Fixes: eec028c9386ed1a ("kcov: remote coverage support")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Marco Elver <elver@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: "Jacky . Cao @ sony . com" <Jacky.Cao@sony.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Marco Elver <elver@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/dev-tools/kcov.rst
include/uapi/linux/kcov.h

index 36890b026e7777b206b8da3ca107f9ad81cb89b2..1c4e1825d769590a98aa9371546b8d716bd67ad5 100644 (file)
@@ -251,11 +251,11 @@ selectively from different subsystems.
 .. code-block:: c
 
     struct kcov_remote_arg {
-       unsigned        trace_mode;
-       unsigned        area_size;
-       unsigned        num_handles;
-       uint64_t        common_handle;
-       uint64_t        handles[0];
+       __u32           trace_mode;
+       __u32           area_size;
+       __u32           num_handles;
+       __aligned_u64   common_handle;
+       __aligned_u64   handles[0];
     };
 
     #define KCOV_INIT_TRACE                    _IOR('c', 1, unsigned long)
index 409d3ad1e6e288e8192a6632655ee51d2906132c..1d0350e44ae34c57ae029de544a51c47d9fb0b95 100644 (file)
@@ -9,11 +9,11 @@
  * and the comment before kcov_remote_start() for usage details.
  */
 struct kcov_remote_arg {
-       unsigned int    trace_mode;     /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
-       unsigned int    area_size;      /* Length of coverage buffer in words */
-       unsigned int    num_handles;    /* Size of handles array */
-       __u64           common_handle;
-       __u64           handles[0];
+       __u32           trace_mode;     /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
+       __u32           area_size;      /* Length of coverage buffer in words */
+       __u32           num_handles;    /* Size of handles array */
+       __aligned_u64   common_handle;
+       __aligned_u64   handles[0];
 };
 
 #define KCOV_REMOTE_MAX_HANDLES                0x100