zephyr/samples/net
Robert Lubos 45d9960bc6 samples: net: sockets: echo_client: Fix userspace crash
k_work_* APIs cannot be used from user threads, hence it has to be
replaced with some other solution to retain userspace functionality in
the sample.

This commit reworks the sample as follows:
  * Replace delayed work items with combination of k_timer and a
    dedicated thread to send UDP packets. k_poll_signal is used for
    communication between k_timer callback and UDP thread.
  * As kernel objects should not be placed in a memory modifiable from
    user threads, declare a separate structure for them, and link it
    with the client context structure with a pointer.
  * k_timer_init() is not a system call, therefore it has to be called
    from supervisor thread. Therefore, add an additional function to
    initialize UDP, and use it to initialize kernel objects used by the
    UDP module and grant access for the main thread before it becomes an
    user thread. UDP thread inherits permissions from the parent (main
    thread).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-03-20 16:56:46 +01:00
..
capture includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
cloud treewide: Disable automatic argparse argument shortening 2023-01-26 20:12:36 +09:00
common
dhcpv4_client includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
dns_resolve includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
dsa samples and tests: Add REQUIRED to Zephyr find_package call 2023-03-02 09:58:27 +01:00
eth_native_posix tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
gptp yamllint: fix all yamllint line-length errors 2023-01-04 01:16:45 +09:00
gsm_modem includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
ipv4_autoconf tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
lldp tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
lwm2m_client net: lwm2m: Register callback for firmware update cancel 2023-03-06 12:33:12 +01:00
mdns_responder tests/samples: use integration_plaforms in more tests/samples 2022-11-29 16:03:23 +01:00
mqtt_publisher all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences 2022-12-21 10:09:23 +01:00
mqtt_sn_publisher net/lib: mqtt_sn: Fix MQTT-SN IPv6 Support and assertation in Example 2023-03-09 09:20:53 +01:00
openthread/coprocessor samples: net: openthread: coprocessor: Enable uart1 explicitly 2023-01-16 09:26:10 +01:00
promiscuous_mode includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
sockets samples: net: sockets: echo_client: Fix userspace crash 2023-03-20 16:56:46 +01:00
stats includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
syslog_net all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences 2022-12-21 10:09:23 +01:00
telnet includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
virtual includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
vlan includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
wifi samples: wifi: esp32s2_saola: decrease heap size 2023-03-09 17:21:04 +01:00
wpan_serial samples: Explicitly disable boot USB device support init at boot 2023-01-10 12:21:10 +01:00
wpanusb samples: Explicitly disable boot USB device support init at boot 2023-01-10 12:21:10 +01:00
zperf samples: Explicitly disable boot USB device support init at boot 2023-01-10 12:21:10 +01:00
net.rst