Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented Jun 11, 2018

Functions for per-interface statistics collection used a pointer to a packet that could've been deallocated in the net_conn callback function. In result, application could crash when interface related to the packet was referenced.
To fix that, packet interface is stored earlier, so it can be used instead for statistics collection.

Additionally, increase main stack size for echo_client in prj_qemu_x86.conf, as the default one caused stack overflow during initialization.

Fixes #7423

Signed-off-by: Robert Lubos robert.lubos@nordicsemi.no

@codecov-io
Copy link

codecov-io commented Jun 11, 2018

Codecov Report

Merging #8312 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8312      +/-   ##
==========================================
- Coverage   64.53%   64.53%   -0.01%     
==========================================
  Files         420      420              
  Lines       40122    40123       +1     
  Branches     6763     6763              
==========================================
  Hits        25893    25893              
- Misses      11109    11110       +1     
  Partials     3120     3120
Impacted Files Coverage Δ
subsys/net/ip/net_stats.h 65.83% <ø> (ø) ⬆️
subsys/net/ip/connection.c 78.41% <100%> (+0.05%) ⬆️
subsys/net/ip/ipv6.c 46.3% <100%> (ø) ⬆️
samples/philosophers/src/main.c 96.87% <0%> (-1.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a91f1e5...c884a91. Read the comment docs.

@rlubos rlubos force-pushed the echo-client-fixes branch from e2e5554 to d3ccda6 Compare June 11, 2018 14:13
@rlubos
Copy link
Contributor Author

rlubos commented Jun 11, 2018

While stressing the sample, I've encountered yet another crash, this time inside ipv6 module. I've added a commit covering it, I guess it's pretty self-explainatory.

Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

rlubos added 3 commits June 11, 2018 16:49
Functions for per-interface statistics collection used a pointer to a
packet that could've been deallocated in the net_conn callback function.
In result, application could crash when interface related to the packet
was referenced. To fix that, packet interface is stored earlier, so it
can be used instead for statistics collection.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Default stack size was too small for main thread in qemu_x86
configuration and resulted in stack overflow during initialization.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Because per-interface statistics rely on interface pointer stored in a
net_pkt, it should not be unreferenced before stats are updated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos rlubos force-pushed the echo-client-fixes branch from d3ccda6 to c884a91 Compare June 11, 2018 14:50
@nashif nashif merged commit d494398 into zephyrproject-rtos:master Jun 11, 2018
@rveerama1
Copy link
Contributor

@rlubos we have to increase the main stack size in "prj_qemu_x86_tls.conf" not in "prj_qemu_x86.conf". I missed this.

@rlubos
Copy link
Contributor Author

rlubos commented Jun 14, 2018

not in "prj_qemu_x86.conf"

Are you sure about this? I was hitting stack overflow in this configuration with default stack size. "prj_qemu_x86_tls.conf" needs increased stack as well though, no doubt about it.

@rveerama1
Copy link
Contributor

Are you sure about this? I was hitting stack overflow in this configuration with default stack size.
Ok fine.

@rlubos rlubos deleted the echo-client-fixes branch June 25, 2018 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

samples: net: echo_client: sample runs failed with prj_qemu_x86_tls.conf configuration file

5 participants