[openssl-dev] Seg fault during make test

2015-05-04 Thread John Foley
Is anyone seeing a segmentation fault during the test_verify phase of
make test on 32-bit systems?  I haven't done a full triage yet.  But it
appears to have been introduced by
5b38d54753acdabbf6b1d5e15d38ee81fb0612a2.  The problem no longer occurs
when backing out this commit.  This could be a faulty commit since the
sizeof invocations in this commit would return different values for
32/64 bit systems.



___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread Stephan Mühlstrasser

Am 04.05.15 um 14:51 schrieb John Foley:

Is anyone seeing a segmentation fault during the test_verify phase of
make test on 32-bit systems?  I haven't done a full triage yet.  But it
appears to have been introduced by
5b38d54753acdabbf6b1d5e15d38ee81fb0612a2.  The problem no longer occurs
when backing out this commit.  This could be a faulty commit since the
sizeof invocations in this commit would return different values for
32/64 bit systems.


The sizeof invocations do not return the pointer sizes, but the size of 
the structures pointed to.


The problem is that there's apparently a copypaste error:

https://github.com/openssl/openssl/commit/53ba0a9e91ad203de2943edaf1090ab17ec435fa

172 memset(param, 0, sizeof *paramid);
173 memset(paramid, 0, sizeof *paramid);

The first memset should be fixed to use *param instead of *paramid:

memset(param, 0, sizeof *param);

Regards
Stephan
___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread John Foley
I think you're wrong about sizeof and pointers.  It'll return 4 or 8
depending if it's a 32 or 64 bit system.  Try the following code:

#include stdio.h

typedef struct _s1 {
int x;
int y;
int z;
} S1;

typedef struct _s2 {
double d1;
double d2;
double d3;
double d4;
int x1;
int x2;
} S2;

int main (int argc, char *argv[]) {
S1 *first;
S2 *second;

printf(%d %d\n, sizeof(first), sizeof(second));
}


You're right about the memset, good catch.  So it appears there are two
issues with this commit.



On 05/04/2015 09:35 AM, Stephan Mühlstrasser wrote:
 Am 04.05.15 um 14:51 schrieb John Foley:
 Is anyone seeing a segmentation fault during the test_verify phase of
 make test on 32-bit systems?  I haven't done a full triage yet.  But it
 appears to have been introduced by
 5b38d54753acdabbf6b1d5e15d38ee81fb0612a2.  The problem no longer occurs
 when backing out this commit.  This could be a faulty commit since the
 sizeof invocations in this commit would return different values for
 32/64 bit systems.

 The sizeof invocations do not return the pointer sizes, but the size
 of the structures pointed to.

 The problem is that there's apparently a copypaste error:

 https://github.com/openssl/openssl/commit/53ba0a9e91ad203de2943edaf1090ab17ec435fa


 172 memset(param, 0, sizeof *paramid);
 173 memset(paramid, 0, sizeof *paramid);

 The first memset should be fixed to use *param instead of *paramid:

 memset(param, 0, sizeof *param);

 Regards
 Stephan
 ___
 openssl-dev mailing list
 To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread Salz, Rich
 172 memset(param, 0, sizeof *paramid);
 173 memset(paramid, 0, sizeof *paramid);
 
 The first memset should be fixed to use *param instead of *paramid:

Yes, oops.  Fixed shortl.
___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread Salz, Rich
 printf(%d %d\n, sizeof(first), sizeof(second)); }

But the code does sizeof *first and sizeof *second

Stephan's write, the memset is bug that slipped through.
___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread Stephan Mühlstrasser

Am 04.05.15 um 16:19 schrieb John Foley:

I think you're wrong about sizeof and pointers.  It'll return 4 or 8
depending if it's a 32 or 64 bit system.  Try the following code:

#include stdio.h

typedef struct _s1 {
 int x;
 int y;
 int z;
} S1;

typedef struct _s2 {
 double d1;
 double d2;
 double d3;
 double d4;
 int x1;
 int x2;
} S2;

int main (int argc, char *argv[]) {
 S1 *first;
 S2 *second;

 printf(%d %d\n, sizeof(first), sizeof(second));
}


Yes, but that is different from what is relevant in the commit 
53ba0a9e91ad203de2943edaf1090ab17ec435fa.


You're right that in your test program you will get always different 
output on 32-bit and 64-bit systems because the pointer size is different.


But the code in the OpenSSL uses sizeof(*pointer) and not 
sizeof(pointer). sizeof(*pointer) gets the size of the structure to 
which pointer points.


So try the following in your test program

printf(%d %d\n, sizeof(*first), sizeof(*second));

This might return different output on 32-bit and 64-bit systems, but it 
might also return the same output, depending on the size of the basic 
types and the padding in the structures.



You're right about the memset, good catch.  So it appears there are two
issues with this commit.



On 05/04/2015 09:35 AM, Stephan Mühlstrasser wrote:

Am 04.05.15 um 14:51 schrieb John Foley:

Is anyone seeing a segmentation fault during the test_verify phase of
make test on 32-bit systems?  I haven't done a full triage yet.  But it
appears to have been introduced by
5b38d54753acdabbf6b1d5e15d38ee81fb0612a2.  The problem no longer occurs
when backing out this commit.  This could be a faulty commit since the
sizeof invocations in this commit would return different values for
32/64 bit systems.


The sizeof invocations do not return the pointer sizes, but the size
of the structures pointed to.

The problem is that there's apparently a copypaste error:

https://github.com/openssl/openssl/commit/53ba0a9e91ad203de2943edaf1090ab17ec435fa


172 memset(param, 0, sizeof *paramid);
173 memset(paramid, 0, sizeof *paramid);

The first memset should be fixed to use *param instead of *paramid:

memset(param, 0, sizeof *param);

Regards
Stephan
___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev



___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev




___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread John Foley
My bad, I overlooked the dereference operator.  Thanks for correcting me.


On 05/04/2015 10:36 AM, Stephan Mühlstrasser wrote:
 Am 04.05.15 um 16:19 schrieb John Foley:
 I think you're wrong about sizeof and pointers.  It'll return 4 or 8
 depending if it's a 32 or 64 bit system.  Try the following code:

 #include stdio.h

 typedef struct _s1 {
  int x;
  int y;
  int z;
 } S1;

 typedef struct _s2 {
  double d1;
  double d2;
  double d3;
  double d4;
  int x1;
  int x2;
 } S2;

 int main (int argc, char *argv[]) {
  S1 *first;
  S2 *second;

  printf(%d %d\n, sizeof(first), sizeof(second));
 }

 Yes, but that is different from what is relevant in the commit
 53ba0a9e91ad203de2943edaf1090ab17ec435fa.

 You're right that in your test program you will get always different
 output on 32-bit and 64-bit systems because the pointer size is
 different.

 But the code in the OpenSSL uses sizeof(*pointer) and not
 sizeof(pointer). sizeof(*pointer) gets the size of the structure
 to which pointer points.

 So try the following in your test program

 printf(%d %d\n, sizeof(*first), sizeof(*second));

 This might return different output on 32-bit and 64-bit systems, but
 it might also return the same output, depending on the size of the
 basic types and the padding in the structures.

 You're right about the memset, good catch.  So it appears there are two
 issues with this commit.



 On 05/04/2015 09:35 AM, Stephan Mühlstrasser wrote:
 Am 04.05.15 um 14:51 schrieb John Foley:
 Is anyone seeing a segmentation fault during the test_verify phase of
 make test on 32-bit systems?  I haven't done a full triage yet. 
 But it
 appears to have been introduced by
 5b38d54753acdabbf6b1d5e15d38ee81fb0612a2.  The problem no longer
 occurs
 when backing out this commit.  This could be a faulty commit since the
 sizeof invocations in this commit would return different values for
 32/64 bit systems.

 The sizeof invocations do not return the pointer sizes, but the size
 of the structures pointed to.

 The problem is that there's apparently a copypaste error:

 https://github.com/openssl/openssl/commit/53ba0a9e91ad203de2943edaf1090ab17ec435fa



 172 memset(param, 0, sizeof *paramid);
 173 memset(paramid, 0, sizeof *paramid);

 The first memset should be fixed to use *param instead of *paramid:

 memset(param, 0, sizeof *param);

 Regards
 Stephan
 ___
 openssl-dev mailing list
 To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


 ___
 openssl-dev mailing list
 To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev



 ___
 openssl-dev mailing list
 To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
 .


___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] Seg fault during make test

2015-05-04 Thread Viktor Dukhovni
On Mon, May 04, 2015 at 02:37:54PM +, Salz, Rich wrote:

  printf(%d %d\n, sizeof(first), sizeof(second)); }
 
 But the code does sizeof *first and sizeof *second

THe problem is a cut/paste error:

memset(param, 0, sizeof *paramid);
memset(paramid, 0, sizeof *paramid);

The first of these should be param, not paramid.

-- 
Viktor.
___
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev