Add check to confirm IHK and McKernel with the same version are used

This commit is contained in:
Masamichi Takagi
2018-01-24 00:16:12 +09:00
parent 4bb65494e9
commit d4459cf9f3
6 changed files with 58 additions and 5 deletions

View File

@@ -76,6 +76,7 @@
#include <asm/prctl.h>
#endif /* !POSTK_DEBUG_ARCH_DEP_77 */
#include "../include/uprotocol.h"
#include <ihk/ihk_host_user.h>
#include <getopt.h>
#include "archdep.h"
#include "arch_args.h"
@@ -1754,6 +1755,8 @@ static int
opendev()
{
int f;
char buildid[] = BUILDID;
char query_result[sizeof(BUILDID)];
sprintf(dev, "/dev/mcos%d", mcosid);
@@ -1765,6 +1768,18 @@ opendev()
}
fd = f;
if (ioctl(fd, IHK_OS_GET_BUILDID, query_result)) {
fprintf(stderr, "Error: IHK_OS_GET_BUILDID failed");
close(fd);
return -1;
}
if (strncmp(buildid, query_result, sizeof(buildid))) {
fprintf(stderr, "Error: build-id of mcexec (%s) didn't match that of IHK (%s)\n", buildid, query_result);
close(fd);
return -1;
}
return fd;
}