Hi Everyone,
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
GMP is 6.1.2, which is the latest version.
Could someone please advise.
Thanks.
On Sat, Dec 29, 2018 at 2:17 PM Jeffrey Walton noloader@gmail.com wrote:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
GMP is 6.1.2, which is the latest version.
This is failing on Aarch64, too.
Jeff
On Sat, Dec 29, 2018 at 9:07 PM Jeffrey Walton noloader@gmail.com wrote:
On Sat, Dec 29, 2018 at 2:17 PM Jeffrey Walton noloader@gmail.com wrote:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
GMP is 6.1.2, which is the latest version.
This is failing on Aarch64, too.
And I just duplicated with 32-bit code on Solaris. I have not been able to test ARM A-32. GMP build is broken.
Jeff
Jeffrey Walton noloader@gmail.com writes:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
This is an ASSERT_ALWAYS in gmp's mpn/generic/sec_powm.c, checking the return value from the win_size function. To debug, it would be helpful to know
1. The value of enb and windowsize at the crash.
2. The definition of POWM_SEC_TABLE (defined in the platform specific gmp-mparam.h), and used by the win_size function in this file.
To me, it looks like the assert validates that POWM_SEC_TABLE confoems to expectations.
It might also be a bug in the book-keeping of scratch space, leading to some memory overwrite. Try running the test program under valgrind and/or asan?
Regards, /Niels
On Sun, Dec 30, 2018 at 5:27 PM Niels Möller nisse@lysator.liu.se wrote:
Jeffrey Walton noloader@gmail.com writes:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
This is an ASSERT_ALWAYS in gmp's mpn/generic/sec_powm.c, checking the return value from the win_size function. To debug, it would be helpful to know
Here are the options I used to build GMP 6.1.2 and Nettle 3.1.4. It looks fairly easy to duplicate on 64-bit platforms.
BUILD_BITS: 64-bits INSTX_PREFIX: /usr/local INSTX_LIBDIR: /usr/local/lib64
PKGCONFPATH: /usr/local/lib64/pkgconfig CPPFLAGS: -I/usr/local/include -DNDEBUG CFLAGS: -g2 -O2 -march=native -fPIC CXXFLAGS: -g2 -O2 -march=native -fPIC LDFLAGS: -L/usr/local/lib64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags LDLIBS: -ldl -lpthread
Then, I run configure. There's nothing special about what I am doing. I'm just getting into a Release Build state.
The value of enb and windowsize at the crash.
The definition of POWM_SEC_TABLE (defined in the platform specific gmp-mparam.h), and used by the win_size function in this file.
To me, it looks like the assert validates that POWM_SEC_TABLE conforms to expectations.
It might also be a bug in the book-keeping of scratch space, leading to some memory overwrite. Try running the test program under valgrind and/or asan?
Thanks Niels.
I'll try to get to it later tonight or tomorrow.
In the meantime you might provide your test data to GMP. It looks like it would make a good test case for them.
Jeff
Jeffrey Walton noloader@gmail.com writes:
Here are the options I used to build GMP 6.1.2 and Nettle 3.1.4. It looks fairly easy to duplicate on 64-bit platforms.
BUILD_BITS: 64-bits INSTX_PREFIX: /usr/local INSTX_LIBDIR: /usr/local/lib64
PKGCONFPATH: /usr/local/lib64/pkgconfig CPPFLAGS: -I/usr/local/include -DNDEBUG CFLAGS: -g2 -O2 -march=native -fPIC CXXFLAGS: -g2 -O2 -march=native -fPIC LDFLAGS: -L/usr/local/lib64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags LDLIBS: -ldl -lpthread
Then, I run configure. There's nothing special about what I am doing. I'm just getting into a Release Build state.
What platform did configure detect? And in particular, which file is the gmp-mparam.h symlink at the top of the gmp build tree pointed to, and what's the definition of POWM_SEC_TABLE there?
Regards, /Niels
On Sun, Dec 30, 2018 at 5:27 PM Niels Möller nisse@lysator.liu.se wrote:
It might also be a bug in the book-keeping of scratch space, leading to some memory overwrite. Try running the test program under valgrind and/or asan?
Hey Niels,
What is the test name and how do I run it?
Given I've built the library and the test suite, what are the next steps? (I'm guessing cd somewhere and and valgrind <some program>).
Jeff
Jeffrey Walton noloader@gmail.com writes:
What is the test name and how do I run it?
At the top of the nettle build tree, to run just that test:
LD_LIBRARY_PATH=.lib ./testsuite/rsa-sec-decrypt-test
To run it (or some other set of tests under valgrind), one can also use
make -C testsuite/ check EMULATOR='$(VALGRIND)' TS_ALL=rsa-sec-decrypt-test
Given I've built the library and the test suite, what are the next steps?
If you don't find any bug with the aid of valgrind, next step would be to run the test program under gdb (it looks like you already built gmp with debug info enabled), set a break point on __gmpn_sec_powm (name-mangled symbol name for mpn_pown_sec), and try to find out where the bad value for windowsize comes from.
BTW, you did run gmp's make check, I hope?
Regards, /Niels
Jeffrey Walton noloader@gmail.com writes:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
(This was a test with -DNDEBUG, a configuration not covered by the gitlab ci testers). Turned out to be a bug in the test code,
assert (mpz_invert(key->d, pub->e, phi));
Fixed (on the release-3.4-fixes branch) with commit https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab0810781...
There was another -DNDEBUG breakage in examples/nettle-openssl.c, which was fixed on master long ago, but which I overlooked when cherry-picking bugfixes for nettle-3.4.1. Also fixed now.
Question for the list: I'm now aware of two bugs in nettle-3.4.1:
1. Accidental use of c99 loops, breaking builds with c89 compilers.
2. Incorrect asserts, affecting tests and benchmark code when compield with -DNDEBUG, but not the libraries themselves.
Should I make a 3.4.2 release fixing these problems?
Regards, /Niels
They seem minor enough not to really need a new release IMO, people can get them from master as needed. Or maybe you can commit patches on the 3.4 branch so people can find them more easily if they really care.
I have a question though, why C89 support ? C99 is already almost 20y old already ...
Regards, Simo.
On Sun, 2019-01-06 at 11:25 +0100, Niels Möller wrote:
Jeffrey Walton noloader@gmail.com writes:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
(This was a test with -DNDEBUG, a configuration not covered by the gitlab ci testers). Turned out to be a bug in the test code,
assert (mpz_invert(key->d, pub->e, phi));
Fixed (on the release-3.4-fixes branch) with commit https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab0810781...
There was another -DNDEBUG breakage in examples/nettle-openssl.c, which was fixed on master long ago, but which I overlooked when cherry-picking bugfixes for nettle-3.4.1. Also fixed now.
Question for the list: I'm now aware of two bugs in nettle-3.4.1:
Accidental use of c99 loops, breaking builds with c89 compilers.
Incorrect asserts, affecting tests and benchmark code when compield with -DNDEBUG, but not the libraries themselves.
Should I make a 3.4.2 release fixing these problems?
Regards, /Niels
On 07.01.19 19:24, Simo Sorce wrote:
They seem minor enough not to really need a new release IMO, people can get them from master as needed. Or maybe you can commit patches on the 3.4 branch so people can find them more easily if they really care.
I have a question though, why C89 support ? C99 is already almost 20y old already ...
There are still modern compilers that lack full C99 support. I am not sure about embedded systems with special C compilers...
Regards, Tim
On Sun, 2019-01-06 at 11:25 +0100, Niels Möller wrote:
Jeffrey Walton noloader@gmail.com writes:
I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched). Self tests are failing at:
PASS: rsa-sec-decrypt sec_powm.c:293: GNU MP assertion failed: enb >= windowsize ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags FAIL: rsa-compute-root PASS: dsa PASS: dsa-keygen
(This was a test with -DNDEBUG, a configuration not covered by the gitlab ci testers). Turned out to be a bug in the test code,
assert (mpz_invert(key->d, pub->e, phi));
Fixed (on the release-3.4-fixes branch) with commit https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab0810781...
There was another -DNDEBUG breakage in examples/nettle-openssl.c, which was fixed on master long ago, but which I overlooked when cherry-picking bugfixes for nettle-3.4.1. Also fixed now.
Question for the list: I'm now aware of two bugs in nettle-3.4.1:
Accidental use of c99 loops, breaking builds with c89 compilers.
Incorrect asserts, affecting tests and benchmark code when compield with -DNDEBUG, but not the libraries themselves.
Should I make a 3.4.2 release fixing these problems?
Regards, /Niels
Simo Sorce simo@redhat.com writes:
I have a question though, why C89 support ?
Code was written for c89 aka ansi-c. So it's not difficult to keep supporting it, and it might help for some (embedded mainly, I imagine) compilers.
That said, I'm about to delete nettle-stdint.h, and require that the compiler supplies a <stdint.h> (as was discussed quite a while ago).
Regards, /Niels
nisse@lysator.liu.se (Niels Möller) writes:
That said, I'm about to delete nettle-stdint.h, and require that the compiler supplies a <stdint.h> (as was discussed quite a while ago).
I've now merged changes to do that to the master-updates branch. It breaks the gnutls build, see https://gitlab.com/gnutls/nettle/-/jobs/149522724,
In file included from gost/gost28147.c:40: gost/nettle-write.h:40:10: fatal error: nettle/nettle-stdint.h: No such file or directory #include <nettle/nettle-stdint.h> ^~~~~~~~~~~~~~~~~~~~~~~~
Is this easy to fix (e.g., include nettle-types.h instead?), or should I add an installed header nettle/nettle-stdint.h containing only
#include <stdint.h>
?
Regards, /Niels
Hello,
ср, 23 янв. 2019 г. в 00:45, Niels Möller nisse@lysator.liu.se:
nisse@lysator.liu.se (Niels Möller) writes:
That said, I'm about to delete nettle-stdint.h, and require that the compiler supplies a <stdint.h> (as was discussed quite a while ago).
I've now merged changes to do that to the master-updates branch. It breaks the gnutls build, see https://gitlab.com/gnutls/nettle/-/jobs/149522724,
In file included from gost/gost28147.c:40: gost/nettle-write.h:40:10: fatal error: nettle/nettle-stdint.h: No such file or directory #include <nettle/nettle-stdint.h> ^~~~~~~~~~~~~~~~~~~~~~~~
This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls to just include <stdint.h> there. I'll open a MR.
Dmitry Eremin-Solenikov dbaryshkov@gmail.com writes:
This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls to just include <stdint.h> there. I'll open a MR.
Sounds good, thanks!
nettle-stdint.h is not advertised, or mentioned in the documentation, so I hope it's very rare for applications to include it directly. According to https://codesearch.debian.net/search?q=nettle-stdint.h, nettle and gnutls are the only debian packages doing that.
Regards, /Niels
Hello,
ср, 23 янв. 2019 г. в 01:01, Niels Möller nisse@lysator.liu.se:
Dmitry Eremin-Solenikov dbaryshkov@gmail.com writes:
This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls to just include <stdint.h> there. I'll open a MR.
I'm sorry for the delay. I've opened https://gitlab.com/gnutls/gnutls/merge_requests/901 .
Dmitry Eremin-Solenikov dbaryshkov@gmail.com writes:
This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls to just include <stdint.h> there. I'll open a MR.
I'm sorry for the delay. I've opened https://gitlab.com/gnutls/gnutls/merge_requests/901 .
Excellent! And now the gnutls build in nettle's gitlab ci succeed.
Regards, /Niels
nettle-bugs@lists.lysator.liu.se