MinhLy1
Contributor
Contributor

VixDiskLib_Open cause crash process running on ESXi ssh console

Hello,

I'm struggling with the issue.

I write a sample app by C language.  I deploy the app on ESXi and run is via ssh. The app crashes with "Segmentation fault" error as calling to VixDiskLib_Open.

Using ulimit -a on ESXi console the output is:

[root@localhost:~] ulimit -a
-f: file size (blocks) unlimited
-t: cpu time (seconds) unlimited
-d: data seg size (kb) unlimited
-s: stack size (kb) 512
-c: core file size (blocks) 0
-m: resident set size (kb) unlimited
-l: locked memory (kb) unlimited
-p: processes 4096
-n: file descriptors 256
-v: address space (kb) unlimited
-w: locks unlimited
-e: scheduling priority unlimited
-r: real-time priority unlimited

Please help me on this issue! Thank you!

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

1. My code:

VixDiskLibHandle DiskOpen(VixDiskLibConnection connection, const char *path, uint32 flags)
{
   VixDiskLibHandle diskHandle = NULL;
   VixDiskLibInfo *info;
   int id = 0;

   VixError vixError = VixDiskLib_Open(connection, path, flags, &diskHandle);

   if(VIX_OK == vixError)
      printf("VixDiskLib_Open: OK\n");
   else if(VIX_E_FAIL == vixError)
      printf("VixDiskLib_Open: VIX_E_FAIL\n");
   else
      printf("VixDiskLib_Open: ERROR\n");

   return diskHandle;
}

void DiskClose(VixDiskLibHandle diskHandle)
{
   if (VixDiskLib_Close(diskHandle) == VIX_OK)
   {
      printf("DiskClose - VIX_OK\n");
   }
   else
   {
      printf("DiskClose - VIX_E_FAIL\n");
   }
}

void DiskRecoveryTest(const char* vmdkPath, const char* journalPath, char* rcvTime)
{
   VixError vixError = VixDiskLib_InitEx(VIXDISKLIB_VERSION_MAJOR,
                           VIXDISKLIB_VERSION_MINOR,
                           &LogFunc, &WarnFunc, &PanicFunc,
                           "/vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmware-vix-disklib-distrib",
                           "/vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/init.cfg");

   if(VIX_OK == vixError)
      printf("VixDiskLib_InitEx: OK\n");
   else if(VIX_E_FAIL == vixError)
      printf("VixDiskLib_InitEx: VIX_E_FAIL\n");
   else
      printf("VixDiskLib_InitEx: ERROR\n");

   VixDiskLibConnection connection = NULL;
   vixError = VixDiskLib_Connect(NULL, &connection);

   if(VIX_OK == vixError)
      printf("VixDiskLib_Connect: OK\n");
   else if(VIX_E_FAIL == vixError)
      printf("VixDiskLib_Connect: VIX_E_FAIL\n");
   else
      printf("VixDiskLib_Connect: ERROR\n");

   uint64_t recoveryTime = strtoul(rcvTime, NULL, 16);

   printf("vmdkPath: %s\n", vmdkPath);

   VixDiskLibHandle diskHandle = DiskOpen(connection, vmdkPath, 0);

   if (NULL != diskHandle)
   {
      printf("DiskOpen: %s\n", "OK");
   }
   else
   {
      printf("DiskOpen: %s\n", "FAILED");
   }

   if (NULL != diskHandle)
   {
      DiskClose(diskHandle);
   }

   if (NULL != connection)
   {
      VixDiskLib_Disconnect(connection);
   }

   VixDiskLib_Exit();

   printf("DiskExit: %s\n", "OK");
}

int main(int argc, char *argv[])
{
   if(argc == 5)
   {
      int i;

      for (i = 0; i < argc; i++ )
      {
         printf("arg %d = %s\n", i, argv[i]);
      }

      if (strcmp(argv[1], "-recover") == 0)
      {

         DiskRecoveryTest(argv[3], argv[4], argv[2]);
      }
   }

   return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

2. The output on console:

[root@localhost:~] /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmdktool -recover 175FAC6E975 /vmfs/volumes/5f0743b9-0f3
28a37-9231-0050569bb382/CENTOS7.64.TEST01/CENTOS7.64.TEST01.vmdk /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/journal/testing
-sh: /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmdktool: not found
[root@localhost:~] /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmdktoolpure -recover 175FAC6E975 /vmfs/volumes/5f0743b9
-0f328a37-9231-0050569bb382/CENTOS7.64.TEST01/CENTOS7.64.TEST01.vmdk /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/journal/testing
arg 0 = /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmdktoolpure
arg 1 = -recover
arg 2 = 175FAC6E975
arg 3 = /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/CENTOS7.64.TEST01/CENTOS7.64.TEST01.vmdk
arg 4 = /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/journal/testing
Log: OBJLIB-LIB: Objlib initialized.
Log: VixDiskLib: Attempting to locate advanced transport module in "/vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmware-vix-disklib-distrib".
Log: VixDiskLib: Advanced transport plugin /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/tmp/vmdktool/vmware-vix-disklib-distrib/lib64/libdiskLibPlugin.so was successfully loaded into vixDiskLib.
Log: VixDiskLib: Enabling advanced transport modes.
Log: DictionaryLoad: Cannot open file "/usr/lib/vmware/config": No such file or directory.
Log: [msg.dictionary.load.openFailed] Cannot open file "/usr/lib/vmware/config": No such file or directory.
Log: PREF Optional preferences file not found at /usr/lib/vmware/config. Using default values.
Log: DictionaryLoad: Cannot open file "//.vmware/config": No such file or directory.
Log: [msg.dictionary.load.openFailed] Cannot open file "//.vmware/config": No such file or directory.
Log: PREF Optional preferences file not found at //.vmware/config. Using default values.
Log: DictionaryLoad: Cannot open file "//.vmware/preferences": No such file or directory.
Log: [msg.dictionary.load.openFailed] Cannot open file "//.vmware/preferences": No such file or directory.
Log: PREF Optional preferences file not found at //.vmware/preferences. Using default values.
Log: lib/ssl: OpenSSL using FIPS_drbg for RAND
Log: lib/ssl: protocol list tls1.2
Log: lib/ssl: protocol list tls1.2 (openssl flags 0x17000000)
Log: lib/ssl: cipher list ECDHE+AESGCM:RSA+AESGCM:ECDHE+AES:RSA+AES
Log: lib/ssl: curves list prime256v1:secp384r1:secp521r1
Log: VixDiskLib: Initialize transport modes.
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC connection accept timeout: 180000 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC request timeout: 180000 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC read timeout: 60000 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC write timeout: 600000 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC fssrvr request timeout: 0 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC fssrvr write timeout: 0 milliseconds
Log: 2021-02-26T18:19:33.767Z info -[265421] [Originator@6876 sub=Libs] [NFC VERBOSE]NFC max recv retries: 1
Log: 2021-02-26T18:19:33.768Z info -[265421] [Originator@6876 sub=Libs] DictionaryLoad: Cannot open file "/usr/lib/vmware/config": No such file or directory.
Log: 2021-02-26T18:19:33.768Z info -[265421] [Originator@6876 sub=Libs] [msg.dictionary.load.openFailed] Cannot open file "/usr/lib/vmware/config": No such file or directory.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] PREF Optional preferences file not found at /usr/lib/vmware/config. Using default values.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] DictionaryLoad: Cannot open file "//.vmware/config": No such file or directory.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] [msg.dictionary.load.openFailed] Cannot open file "//.vmware/config": No such file or directory.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] PREF Optional preferences file not found at //.vmware/config. Using default values.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] DictionaryLoad: Cannot open file "//.vmware/preferences": No such file or directory.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] [msg.dictionary.load.openFailed] Cannot open file "//.vmware/preferences": No such file or directory.
Log: 2021-02-26T18:19:33.769Z info -[265421] [Originator@6876 sub=Libs] PREF Optional preferences file not found at //.vmware/preferences. Using default values.
Log: 2021-02-26T18:19:33.770Z info -[265421] [Originator@6876 sub=Libs] lib/ssl: OpenSSL using FIPS_drbg for RAND
Log: 2021-02-26T18:19:33.770Z info -[265421] [Originator@6876 sub=Libs] lib/ssl: protocol list tls1.2
Log: 2021-02-26T18:19:33.770Z info -[265421] [Originator@6876 sub=Libs] lib/ssl: protocol list tls1.2 (openssl flags 0x17000000)
Log: 2021-02-26T18:19:33.770Z info -[265421] [Originator@6876 sub=Libs] lib/ssl: cipher list ECDHE+AESGCM:RSA+AESGCM:ECDHE+AES:RSA+AES
Log: 2021-02-26T18:19:33.770Z info -[265421] [Originator@6876 sub=Libs] lib/ssl: curves list prime256v1:secp384r1:secp521r1
Log: VixDiskLib: Available transport modes: file:san:hotadd:nbdssl:nbd.
Log: VMware VixDiskLib (7.0.1) Release build-16860560
Log: [NFC VERBOSE]NFC connection accept timeout: 180000 milliseconds
Log: [NFC VERBOSE]NFC request timeout: 180000 milliseconds
Log: [NFC VERBOSE]NFC read timeout: 60000 milliseconds
Log: [NFC VERBOSE]NFC write timeout: 600000 milliseconds
Log: [NFC VERBOSE]NFC fssrvr request timeout: 0 milliseconds
Log: [NFC VERBOSE]NFC fssrvr write timeout: 0 milliseconds
Log: [NFC VERBOSE]NFC max recv retries: 1
VixDiskLib_InitEx: OK
Log: VixDiskLib: VixDiskLib_Connect: Establish connection.
VixDiskLib_Connect: OK
vmdkPath: /vmfs/volumes/5f0743b9-0f328a37-9231-0050569bb382/CENTOS7.64.TEST01/CENTOS7.64.TEST01.vmdk

Log: VixDiskLib: VixDiskLib_OpenEx: Open a disk.
Segmentation fault

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 Kudos
0 Replies