[GH-ISSUE #2277] *2john tools fail in CPU fallback due to path_init() is not been called soon enough #1526

Closed
opened 2026-10-15 04:19:24 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @ghost on GitHub (Sep 17, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2277

Isn't a patch like this mandatory?

diff --git a/src/john.c b/src/john.c
index f230335..6c82b10 100644
--- a/src/john.c
+++ b/src/john.c
@@ -1408,7 +1408,6 @@ static void john_init(char *name, int argc, char **argv)
        if (make_check)
                argv[1] = "--test=0";

-       path_init(argv);
        CPU_detect_or_fallback(argv, make_check);

 #if HAVE_MPI
@@ -1891,6 +1890,7 @@ int main(int argc, char **argv)

        /* put the crc table init here, so that tables are fully setup for any ancillary program */
        CRC32_Init_tab();
+       path_init(argv);

        if (!strcmp(name, "unshadow")) {
                CPU_detect_or_fallback(argv, 0);
Originally created by @ghost on GitHub (Sep 17, 2016). Original GitHub issue: https://github.com/openwall/john/issues/2277 Isn't a patch like this mandatory? ``` diff --git a/src/john.c b/src/john.c index f230335..6c82b10 100644 --- a/src/john.c +++ b/src/john.c @@ -1408,7 +1408,6 @@ static void john_init(char *name, int argc, char **argv) if (make_check) argv[1] = "--test=0"; - path_init(argv); CPU_detect_or_fallback(argv, make_check); #if HAVE_MPI @@ -1891,6 +1890,7 @@ int main(int argc, char **argv) /* put the crc table init here, so that tables are fully setup for any ancillary program */ CRC32_Init_tab(); + path_init(argv); if (!strcmp(name, "unshadow")) { CPU_detect_or_fallback(argv, 0); ```
bsakaguchi 2026-10-15 04:19:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (Sep 18, 2016):

john Proper has it in john_init() right after the

 #ifdef HAVE_JOHN_OMP_FALLBACK
                john_omp_fallback(argv);
 #endif

...so even later than Jumbo.

<!-- gh-comment-id:247876424 --> @magnumripper commented on GitHub (Sep 18, 2016): john Proper has it in `john_init()` right after the ``` c #ifdef HAVE_JOHN_OMP_FALLBACK john_omp_fallback(argv); #endif ``` ...so even later than Jumbo.
Author
Owner

@magnumripper commented on GitHub (Sep 18, 2016):

In Jumbo it was placed at current position after 9852e5e8 and 9e5f65aa

<!-- gh-comment-id:247876853 --> @magnumripper commented on GitHub (Sep 18, 2016): In Jumbo it was placed at current position after 9852e5e8 and 9e5f65aa
Author
Owner

@ghost commented on GitHub (Sep 19, 2016):

BTW: probably a better subject (and test case) should be:
*2john tools fail in CPU fallback due to path_init() is not been called soon enough.

Test case:

  • build with CPU fallback
  • call a 2john (being at john/src)
  • it fails ("$JOHN/" is not defined - path_init() is called after the CPU fallback mechanism).
  • call a 2john (being at john/run)
  • it works

Move path_init() to main, line 1900, for example.

  • it works
<!-- gh-comment-id:247897612 --> @ghost commented on GitHub (Sep 19, 2016): BTW: probably a better subject (and test case) should be: *2john tools fail in CPU fallback due to path_init() is not been called soon enough. Test case: - build with CPU fallback - call a 2john (being at john/src) - it fails (**"$JOHN/" is not defined** - path_init() is called after the CPU fallback mechanism). - call a 2john (being at john/run) - it works --- Move path_init() to main, line 1900, for example. - it works
Author
Owner

@ghost commented on GitHub (Sep 19, 2016):

path_init() is necessary before any 2john CPU fallback. Not inside john_init(). An example:

1942    if (!strcmp(name, "gpg2john")) {
1943        CPU_detect_or_fallback(argv, 0);
1944        return gpg2john(argc, argv);
1945    }
...
1965        john_init(name, argc, argv);
<!-- gh-comment-id:247898009 --> @ghost commented on GitHub (Sep 19, 2016): path_init() is necessary before any 2john CPU fallback. Not inside john_init(). An example: ``` 1942 if (!strcmp(name, "gpg2john")) { 1943 CPU_detect_or_fallback(argv, 0); 1944 return gpg2john(argc, argv); 1945 } ... 1965 john_init(name, argc, argv); ```
Author
Owner

@ghost commented on GitHub (Sep 19, 2016):

Because CPU fallback needs to know "$JOHN/".

#define CPU_FALLBACK_PATHNAME path_expand("$JOHN/" CPU_FALLBACK_BINARY)

execv(CPU_FALLBACK_PATHNAME, argv);
<!-- gh-comment-id:247898365 --> @ghost commented on GitHub (Sep 19, 2016): Because CPU fallback needs to know "$JOHN/". ``` #define CPU_FALLBACK_PATHNAME path_expand("$JOHN/" CPU_FALLBACK_BINARY) execv(CPU_FALLBACK_PATHNAME, argv); ```
Author
Owner

@ghost commented on GitHub (Sep 19, 2016):

Ah! There is no "$JOHN" in john Proper.

  • Well, I see a bug in bleeding.
<!-- gh-comment-id:247899766 --> @ghost commented on GitHub (Sep 19, 2016): Ah! There is no "$JOHN" in john Proper. - Well, I see a bug in bleeding.
Author
Owner

@magnumripper commented on GitHub (Sep 19, 2016):

Oh. That explains it. So your original patch is likely what we need.

<!-- gh-comment-id:247916235 --> @magnumripper commented on GitHub (Sep 19, 2016): Oh. That explains it. So your original patch is likely what we need.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1526
No description provided.