This is the mail archive of the mailing list for the systemtap project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH RFC] Fix failure of signing modules on XFS

When using a server, whose filesystem is XFS, to compile scripts, the
following messages are printed and fail to sign modules.

Server: No matching machine owner key (MOK) available on the server to sign the
Server: The server has no machine owner key (MOK) in common with this
system. Use the following command to import a server MOK into this
system, then reboot:

	mokutil --import signing_key.x509

The matching MOK does exist, but the server fails to find it. The detail
is the server searches keys and check whether they are regular files by
dirent.d_type, but XFS dirent.d_type is not supported. This patch uses
S_ISREG to do the check.

Signed-off-by: qiaonuohan <>
 stap-serverd.cxx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/stap-serverd.cxx b/stap-serverd.cxx
index 40b3c39..ad70e8a 100644
--- a/stap-serverd.cxx
+++ b/stap-serverd.cxx
@@ -368,15 +368,18 @@ mok_dir_valid_p (string mok_fingerprint, bool verbose)
   bool priv_found = false;
   bool cert_found = false;
   struct dirent *direntp;
+  struct stat tmpstat;
   while ((direntp = readdir (dirp)) != NULL)
-      if (! priv_found && direntp->d_type == DT_REG
+      //XFS dirent.d_type is not supported, using S_ISREG instead
+      stat((mok_dir + "/" + direntp->d_name).c_str (), &tmpstat);
+      if (! priv_found && S_ISREG(tmpstat.st_mode)
 	  && strcmp (direntp->d_name, MOK_PRIVATE_CERT_NAME) == 0)
 	  priv_found = true;
-      if (! cert_found && direntp->d_type == DT_REG
+      if (! cert_found && S_ISREG(tmpstat.st_mode)
 	  && strcmp (direntp->d_name, MOK_PUBLIC_CERT_NAME) == 0)
 	  cert_found = true;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]