Skip to contentSkip to conversation

lapi/procfs.h: Add elf_prstatus and elf_prpsinfo fallbacks

PATCH Applied Wake Liu via ltp 2 participants 4 messages Oct 2 – Oct 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lapi/procfs.h: Add elf_prstatus and elf_prpsinfo fallbacks

Bionic's <sys/procfs.h> provides elf_gregset_t and struct elf_siginfo, but not struct elf_prstatus or struct elf_prpsinfo, so coredump02 fails to build on Android:

error: incomplete definition of type 'const struct elf_prstatus'

Add configure checks and fallback definitions which follow include/linux/elfcore.h. The timevals and pr_uid/pr_gid use the kernel types, so the layout matches the native core dump format, e.g. 16-bit pr_uid on 32-bit x86 and arm. Use the new header in coredump02.

Fixes 72a170823fb0 ("coredump02: Verify ELF structure and notes")
---
 configure.ac                           |  1 +
 include/lapi/procfs.h                  | 56 ++++++++++++++++++++++++++
 testcases/kernel/coredump/coredump02.c |  2 +-
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 include/lapi/procfs.h
configure.ac +1 -0
index e979de0e7..370c2e74f 100644
@@ -201,6 +201,7 @@ AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
 AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include <linux/if_alg.h>])
 AC_CHECK_TYPES([struct clone_args],,,[#include <sched.h>])
 AC_CHECK_TYPES([struct sched_attr],,,[#include <sched.h>])
+AC_CHECK_TYPES([struct elf_prpsinfo, struct elf_prstatus],,,[#include <sys/procfs.h>])
 AC_CHECK_TYPES([struct fanotify_event_info_fid, struct fanotify_event_info_error,
 		struct fanotify_event_info_header, struct fanotify_event_info_pidfd,
 		struct fanotify_event_info_range],,,[#include <sys/fanotify.h>])
include/lapi/procfs.h new file +56 -0

56 lines not on this page · raw message

testcases/kernel/coredump/coredump02.c +1 -1
index 7b0b4c43e..6657a3d71 100644
@@ -40,9 +40,9 @@
  */
 
 #include <link.h>
-#include <sys/procfs.h>
 
 #include "coredump_common.h"
+#include "lapi/procfs.h"
 
 #define NOTE_ALIGN(x) (((x) + 3) & ~3U)
 
Signature · 5 lines
2.56.0.rc1.315.gc6ed9934b7-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Wake,

Quoted 1 line · Wake Liu

lapi/procfs.h: Add elf_prstatus and elf_prpsinfo fallbacks

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp