Hi.

Testing Judy library (for Judy PHP extension), I encounter a
reproducable segfault on x86_64 only (Judy 1.0.5 official release, no
patch applied).

See the reproducer attached (segfault with value ~300)

$ gdb foo
(gdb) run 500
...
OK - bit successfully set at 269
OK - bit successfully set at 270

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7db4590 in j__udyInsWalk (Pjp=Pjp@entry=0x603198,
Index=Index@entry=271, Pjpm=Pjpm@entry=0x603060) at Judy1Set.c:1506
1506                    JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]);

(gdb) bt
#0  0x00007ffff7db4590 in j__udyInsWalk (Pjp=Pjp@entry=0x603198,
Index=Index@entry=271, Pjpm=Pjpm@entry=0x603060) at Judy1Set.c:1506
#1  0x00007ffff7db4fb6 in j__udyInsWalk (Pjp=0x603198,
Pjp@entry=0x603108, Index=Index@entry=271, Pjpm=Pjpm@entry=0x603060) at
Judy1Set.c:1650
#2  0x00007ffff7db4fb6 in j__udyInsWalk (Pjp=0x603108,
Pjp@entry=0x603068, Index=Index@entry=271, Pjpm=Pjpm@entry=0x603060) at
Judy1Set.c:1650
#3  0x00007ffff7db7388 in Judy1Set (PPArray=0x7fffffffdea8, Index=271,
PJError=0x7fffffffde80) at Judy1Set.c:1847
#4  0x000000000040097e in main ()


Have you already encounter this issue ?
Any idea ?


Thanks,
Remi.


CC to Paul (Fedora package owner) and Nicolas (PECL extension owner).
P.S. https://bugzilla.redhat.com/1017338 - fedora bug report
#include <stdio.h>
#include <Judy.h>

int main(int argc, char *argv[])                       // Example program of Judy1 macro APIs
{
  Word_t Index;                 // index (or key)
  Word_t Rcount;                // count of indexes (or bits set)
  Word_t Rc_word;               // full word return value
  int    Rc_int, max;           // boolean values returned (0 or 1)

  Pvoid_t J1Array = (Pvoid_t) NULL; // initialize Judy1 array

  max = (argc>1 ? atoi(argv[1]) : 10);

  for (Index=1 ; Index<max ; Index++) {
	  J1S(Rc_int, J1Array, Index);
	  if (Rc_int == JERR) printf("ERRMEM\n");
	  if (Rc_int == 1) printf("OK - bit successfully set at %lu\n", Index);
	  if (Rc_int == 0) printf("BUG - bit already set at %lu\n", Index);
  }

  J1C(Rcount, J1Array, 0, -1);  // count all bits set in array
  printf("%lu bits set in Judy1 array\n", Rcount);

  J1MU(Rc_word, J1Array);       // how much memory was used?
  printf("%lu Indexes used %lu bytes of memory\n", Rcount, Rc_word);

  Index = 0;
  J1F(Rc_int, J1Array, Index);  // find first bit set in array
  if (Rc_int == 1) printf("OK - first bit set is at %lu\n", Index);
  if (Rc_int == 0) printf("BUG - no bits set in array\n");

  return(0);
}

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to