[riot-notifications] [RIOT-OS/RIOT] core: `msg_receive()` sometimes returns without `msg` being re-set (#10881)

Martine Lenders notifications at github.com
Sun Jan 27 12:40:19 CET 2019


<!--
If your issue is a usage question, please submit it to the user mailing-list
users at riot-os.org or to the developer mailing-list devel at riot-os.org.
If your issue is related to security, please submit it to the security
mailing-list security at riot-os.org.
-->

#### Description
Coming from #6123 I was able to track down the issue to the fact that `msg_receive()` in some corner-cases seems to return without the out parameter being rewritten. I wasn't able to pin-point the exact issue yet and I'm unsure if it is only an issue on `native`.
<!--
Example: Cannot build gnrc_networking application for samr21-xpro board.
-->

#### Steps to reproduce the issue
I applied the following patch to current master (bdd2d52fd57c8cc87f9705b2e31c32f58a123a06, might not apply to later versions, please then try to change manually):

```diff
diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
index feb2e8f10..0c3fa97c4 100644
--- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
+++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
@@ -180,6 +180,7 @@ static void *_event_loop(void *args)
     /* start event loop */
     while (1) {
         DEBUG("ipv6: waiting for incoming message.\n");
+        memset(&msg, 0, sizeof(msg));
         msg_receive(&msg);
 
         switch (msg.type) {
@@ -220,6 +221,7 @@ static void *_event_loop(void *args)
                 gnrc_ipv6_nib_handle_timer_event(msg.content.ptr, msg.type);
                 break;
             default:
+                printf("ipv6: unknown message type 0x%04x\n", msg.type);
                 break;
         }
     }
```

and ran `gnrc_networking`. I then tried to ping the node as described in #10875:

```sh
sudo true; for _ in $(seq 10); do sudo ping -s0 -f "fe80::...%tapbr0" & done
```

<!--
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.
-->

#### Expected results
```
ipv6: unknown message type 0x0000
```

should never show up.
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->

#### Actual results
```
ipv6: unknown message type 0x0000
```

shows up with some regularity
<!--
Please paste or specifically describe the actual output.
-->

#### Versions
bdd2d52fd57c8cc87f9705b2e31c32f58a123a06 on a somewhat recent Arch as of writing this issue.

```
Operating System Environment
-----------------------------
       Operating System: "Arch Linux" 
                 Kernel: Linux 4.20.3-arch1-1-ARCH x86_64 unknown

Installed compiler toolchains
-----------------------------
             native gcc: gcc (GCC) 8.2.1 20181127
      arm-none-eabi-gcc: arm-none-eabi-gcc (Arch Repository) 8.2.0
                avr-gcc: avr-gcc (GCC) 8.2.0
       mips-mti-elf-gcc: missing
             msp430-gcc: missing
   riscv-none-embed-gcc: missing
   xtensa-esp32-elf-gcc: missing
   xtensa-lx106-elf-gcc: missing
                  clang: clang version 7.0.1 (tags/RELEASE_701/final)

Installed compiler libs
-----------------------
   arm-none-eabi-newlib: "3.0.0"
    mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
               avr-libc: "2.0.0" ("20150208")

Installed development tools
---------------------------
                  cmake: cmake version 3.13.3
               cppcheck: missing
                doxygen: 1.8.15
                 flake8: 3.6.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.7.2 on Linux
                    git: git version 2.20.1
                   make: GNU Make 4.2.1
                openocd: missing
                 python: Python 3.7.2
                python2: Python 2.7.15
                python3: Python 3.7.2
             coccinelle: missing
```
<!--
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: ./dist/tools/ci/print_toolchain_versions.sh).
-->

<!-- Thanks for contributing! -->


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/10881
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190127/e56bca46/attachment.html>


More information about the notifications mailing list