From 1a1c866770a6f838a2e38bfaca90b12bb9cec290 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 24 Feb 2022 19:35:32 -0500 Subject: [PATCH] runtime: port to kernel 5.17-rc1+ LKML commit 6dfbbae14a7b961f41 changed the procfs pde-data API. Adapt the runtime via an autoconf tester. --- buildrun.cxx | 1 + runtime/linux/autoconf-pde_data.c | 10 ++++++++++ runtime/proc_fs_compatibility.h | 2 +- runtime/procfs-probes.c | 4 ++++ runtime/procfs.c | 4 ++-- session.cxx | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 runtime/linux/autoconf-pde_data.c diff --git a/buildrun.cxx b/buildrun.cxx index ecaeedaac..70ccfc30e 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -430,6 +430,7 @@ compile_pass (systemtap_session& s) output_exportconf(s, o2, "proc_create_data", "STAPCONF_PROC_CREATE_DATA"); output_autoconf(s, o, cs, "autoconf-proc_ops.c", "STAPCONF_PROC_OPS", NULL); output_exportconf(s, o2, "PDE_DATA", "STAPCONF_PDE_DATA"); + output_autoconf(s, o, cs, "autoconf-pde_data.c", "STAPCONF_PDE_DATA2", NULL); output_autoconf(s, o, cs, "autoconf-module-sect-attrs.c", "STAPCONF_MODULE_SECT_ATTRS", NULL); output_autoconf(s, o, cs, "autoconf-kernel_read-new-args.c", "STAPCONF_KERNEL_READ_NEW_ARGS", NULL); output_autoconf(s, o, cs, "autoconf-utrace-via-tracepoints.c", "STAPCONF_UTRACE_VIA_TRACEPOINTS", NULL); diff --git a/runtime/linux/autoconf-pde_data.c b/runtime/linux/autoconf-pde_data.c new file mode 100644 index 000000000..e8b582330 --- /dev/null +++ b/runtime/linux/autoconf-pde_data.c @@ -0,0 +1,10 @@ +/* detect + linux commit 6dfbbae14a7b961f41d80a106e1ab60e86d061c5 + fs: proc: store PDE()->data into inode->i_private */ + +#include + +void* __something(const struct inode* i) +{ + return pde_data (i); +} diff --git a/runtime/proc_fs_compatibility.h b/runtime/proc_fs_compatibility.h index c94da16d8..0e200c7ff 100644 --- a/runtime/proc_fs_compatibility.h +++ b/runtime/proc_fs_compatibility.h @@ -17,7 +17,7 @@ /* If STAPCONF_PDE_DATA isn't defined, we're using the original /proc * interface (where 'struct proc_dir_entry' isn't opaque). Provide * some of the new interface's functions. */ -#ifndef STAPCONF_PDE_DATA +#if !defined(STAPCONF_PDE_DATA) && !defined(STAPCONF_PDE_DATA2) #ifndef STAPCONF_LINUX_UIDGID_H static void proc_set_user(struct proc_dir_entry *de, uid_t uid, gid_t gid) diff --git a/runtime/procfs-probes.c b/runtime/procfs-probes.c index 96bacac85..15c5e3dee 100644 --- a/runtime/procfs-probes.c +++ b/runtime/procfs-probes.c @@ -56,7 +56,11 @@ _stp_proc_open_file(struct inode *inode, struct file *filp) struct stap_procfs_probe *spp; int res; +#ifdef STAPCONF_PDE_DATA2 + spp = (struct stap_procfs_probe *)pde_data(inode); +#else spp = (struct stap_procfs_probe *)PDE_DATA(inode); +#endif if (spp == NULL) { return -EINVAL; } diff --git a/runtime/procfs.c b/runtime/procfs.c index c2b5aacf2..2d1f3736c 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -28,11 +28,11 @@ #include "uidgid_compatibility.h" -/* If STAPCONF_PDE_DATA isn't defined, we're using the original /proc +/* If STAPCONF_PDE_DATA* aren't defined, we're using the original /proc * interface (where 'struct proc_dir_entry' isn't opaque). In this * case allow the (undocumented) feature of slashes * (i.e. subdirectories) in paths. */ -#ifndef STAPCONF_PDE_DATA +#if !defined(STAPCONF_PDE_DATA) && !defined(STAPCONF_PDE_DATA2) #define _STP_ALLOW_PROCFS_PATH_SUBDIRS #endif diff --git a/session.cxx b/session.cxx index ec1400ee0..ced67da5b 100644 --- a/session.cxx +++ b/session.cxx @@ -495,7 +495,7 @@ systemtap_session::version () "Copyright (C) 2005-2021 Red Hat, Inc. and others\n" // PRERELEASE "This is free software; see the source for copying conditions.\n", version_string().c_str()); - cout << _F("tested kernel versions: %s ... %s\n", "2.6.32", "5.15.0-rc7"); // PRERELEASE + cout << _F("tested kernel versions: %s ... %s\n", "2.6.32", "5.17.0-rc4"); // PRERELEASE cout << _("enabled features:") #ifdef HAVE_AVAHI -- 2.43.5