C Compiler hangs on file with certain Cflags defined

I was testing pgcc 10.2 (and now .3) against john the ripper, a password cracking utility I use for our quarterly audits.

using -fast locks up on BF_std.c. a couple quick compiles and it seems that the compiler drops into a wait state and hangs. Looks like it only happens when both -Mpre and -Munroll=C:1 both are used. Or when -Mpre and -Mvect=sse, or etc.


It also seems that use of -O2 or higher causes a code segfault at execution (john --test works, but opening a shadow file explodes) on blowfish code, so I’m guessing this isn’t the best .c out there. (amongst other options for optimization)

If someone does work this out, I’d be interested in any set of good optimization flags. gcc is OK, but pathscale does a better job on this code. I was thinking as pgi outperforms pathscale elsewhere for us, it would be nice here as well.


OS is CentOS 5.3
john the ripper is 1.7.4.2 (and all previous I’ve tried it on)
pgi is now:
pgcc 10.3-0 64-bit target on x86-64 Linux -tp k8-64e

anything else needed, let me know.

Ed

Hi Ed,

Thanks for the report!

For the first problem, I was able to confirm this issue and have sent a report to our engineers (TPR#16817). The work around is to use the flag “-Mnopre”.

I’m currently investigating the segv. I was able to determine that error occurs in the “rules.c” function “rules_reject” but am out of time for today. I’ll look into it more tomorrow.

In the meantime, you can work around the issue by adding “#pragma routine opt=1” right before the definition for “rules_reject” (line 218).

  • Mat

Hi Ed,

The problem is that the compiler is hoisting the value “db->format->params.flags” out of the loop and assigning it to a register. However, “db” is NULL thus causing the segv. I have sent a report to our engineers (TPR#16824).

To work around the problem, either use the “opt” pragma or modify the code as follows:

char *rules_reject(char *rule, struct db_main *db)
{
   while (RULE)
   switch (LAST) {
   case ':':
   case ' ':
   case '\t':
      break;

   case '-':
      switch (RULE) {
      case 'c':
         //if (!db) continue;
         if (!db || db->format->params.flags & FMT_CASE) continue;
         return NULL;

      case '8':
         //if (!db) continue;
         if (!db || db->format->params.flags & FMT_8_BIT) continue;
         return NULL;

      case 's':
         //if (!db) continue;
         if (!db || db->options->flags & DB_SPLIT) continue;
         return NULL;

      case '\0':
         rules_errno = RULES_ERROR_END;
         return NULL;

      default:
         rules_errno = RULES_ERROR_REJECT;
         return NULL;
      }

   default:
      return rule - 1;
   }

   return rule - 1;
}

Thanks,
Mat

Thanks for checking into it. Glad to see it isn’t just me. ;)


I’m guessing you had version 1.7.3.4? I noticed that the function has changed significantly in the beta versions. I’ll check my 1.7.4.2 and the 1.7.5. and see if I can’t work it out with the author.

Hi Ed,

I just verified that TPR#16817 will be fixed in the 10.5 release. TPR#16824 is still in review.

Thanks,
Mat

Looks like 10.6 included the other. thanks!

Ed,

late notice - TPR 16826 was corrected in the 10.6 release, and is not closed.

regards,
dave

Ed,

I mean TPR 16824 is now closed, not 16824.


dave