This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH RFC] Fix failure of signing modules on XFS
- From: qiaonuohan <qiaonuohan at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Date: Fri, 3 Apr 2015 16:12:06 +0800
- Subject: [PATCH RFC] Fix failure of signing modules on XFS
- Authentication-results: sourceware.org; auth=none
When using a server, whose filesystem is XFS, to compile scripts, the
following messages are printed and fail to sign modules.
<cut>
Server: No matching machine owner key (MOK) available on the server to sign the
module.
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
<cut>
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 <qiaonuohan@cn.fujitsu.com>
---
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;
continue;
}
- 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;
--
1.8.3.1