8000 test/pkg/relic: increase stacksize for paillier encryption by mguetschow · Pull Request #21306 · RIOT-OS/RIOT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test/pkg/relic: increase stacksize for paillier encryption #21306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

mguetschow
Copy link
Contributor
@mguetschow mguetschow commented Mar 19, 2025

Contribution description

The Paillier encryption test from #21301 seems to require a much larger stack, leading the last nightly to fail on the HIL test: https://ci.riot-os.org/details/c88f567b8ff94d0484073f3151c18529/tests

Instead of only increasing the stack (tested to require 25*THREAD_STACKSIZE_DEFAULT on a BOARD=nrf52840dk), leading to insufficient memory on BOARD=samr21-xpro, I've also halfed the relic big number precision to 512 bits, allowing for paillier encryption up to 256 bits as it seems.

Testing procedure

With this reduced precision and the increased stacksize, we get

$ make -C tests/pkg/relic BOARD=nrf52840dk flash test
2025-03-19 12:57:04,219 # main(): This is RIOT! (Version: 2025.04-devel-263-g3c039-tests-pkg-relic-stacksize)
2025-03-19 12:57:07,896 # ...
2025-03-19 12:57:07,897 # OK (3 tests)
2025-03-19 12:57:07,904 # { "threads": [{ "name": "main", "stack_size": 14336, "stack_used": 13568 }]}

and

$ make -C tests/pkg/relic BOARD=samr21-xpro flash test
2025-03-19 12:57:04,219 # main(): This is RIOT! (Version: 2025.04-devel-263-g3c039-tests-pkg-relic-stacksize)
2025-03-19 12:57:07,896 # ...
2025-03-19 12:59:06,042 # OK (3 tests)
2025-03-19 12:59:06,049 # { "threads": [{ "name": "main", "stack_size": 14336, "stack_used": 13656 }]}

I'll run a no-fast-fail build to get all boards with insufficient memory issues.

Issues/PRs references

Fixup after #21301, tagging @krzysztof-cabaj as its author.

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Mar 19, 2025
@mguetschow mguetschow force-pushed the tests-pkg-relic-stacksize branch from c76ba2a to a8232be Compare March 19, 2025 12:01
@mguetschow mguetschow added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: no fast fail don't abort PR build after first error labels Mar 19, 2025
@krzysztof-cabaj
Copy link
Contributor

@mguetschow

I tested Paillier encryption with 512-bit key using nucleo-f207zg and nucleo-f439zi - it works. Do you test 1024 bit key, with increased stack on nrf52840dk and samr21-xpro? Maybe with larger stack 1024 key size will work?

@mguetschow
Copy link
Contributor Author

I tested Paillier encryption with 512-bit key using nucleo-f207zg and nucleo-f439zi - it works.

Hum, could you paste the stacksizes reported at the end of the test here? I'd guess this could have to do with a different THREAD_STACKSIZE_DEFAULT.

Do you test 1024 bit key, with increased stack on nrf52840dk and samr21-xpro? Maybe with larger stack 1024 key size will work?

I can't test on samr21-xpro with unchanged big number precision since the required stacksize is too big for the board. 1024 bit don't even work on native for me though.

@krzysztof-cabaj
Copy link
Contributor

I tested Paillier with 512 bit key using my own program. When I investigated this issue I remember that I manually set stack size
to 6*8192. With line - CFLAGS += -DTHREAD_STACKSIZE_MAIN=49152 in Makefile, tests/pkg/relic pass even with 512 key:

Help: Press s to start test, r to print it is ready
READY
START
main(): This is RIOT! (Version: 2025.04-devel-264-gfab3a)
...
OK (3 tests)
{ "threads": [{ "name": "main", "stack_size": 49152, "stack_used": 24984 }]}

@riot-ci
Copy link
riot-ci commented Mar 19, 2025

Murdock results

✔️ PASSED

285dc27 test/pkg/relic: half bitsize and increase stacksize for paillier

Success Failures Total Runtime
20 0 20 01m:29s

Artifacts

@mguetschow
Copy link
Contributor Author

With line - CFLAGS += -DTHREAD_STACKSIZE_MAIN=49152 in Makefile, tests/pkg/relic pass even with 512 key:

Sure, I guess that's expected. But to avoid the giant stacksize requirement which would effectively prevent HIL tests on the samr21-xpro, I'd propose to reduce the key size for this test and only increase the stacksize moderately.

@krzysztof-cabaj
Copy link
Contributor

I have just checked that for example samr21-xpro has only 32KiB of RAM.

Yes, reducing the stack size, relic precision and Paillier key size is a good idea.

@mguetschow mguetschow force-pushed the tests-pkg-relic-stacksize branch from a8232be to 285dc27 Compare March 19, 2025 14:01
@mguetschow mguetschow requested review from benpicco and maribu March 19, 2025 14:02
@maribu maribu enabled auto-merge March 19, 2025 16:07
@maribu maribu added this pull request to the merge queue Mar 19, 2025
Merged via the queue into RIOT-OS:master with commit 06d2b69 Mar 19, 2025
26 checks passed
@mguetschow mguetschow deleted the tests-pkg-relic-stacksize branch March 20, 2025 09:09
@mguetschow
Copy link
Contributor Author

Thanks everyone!

@mguetschow mguetschow added this to the Release 2025.04 milestone Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tests Area: tests and testing framework CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0