Commit graph

42249 commits

Author SHA1 Message Date
Carles Cufi
40b02ee891 doc: relnotes: Add 2.4 release notes draft
Add a working draft for the 2.4.0 release notes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 22:03:54 +02:00
Carles Cufi
bb2bc44367 doc: relnotes: Remove draft status from 2.3 release notes
Mark the release notes as complete.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 22:03:54 +02:00
Carles Cufi
8beda01c0f doc: reference: Update overview for 2.3
Update the API overview page by looking at the changes in include/ since
the last release.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:36:16 +02:00
Carles Cufi
89a0bcd1cf doc: relnotes: Add a known issues section
Add a known issues section with the current high-priority bug listed in
it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:35:56 +02:00
Carles Cufi
b752e05bab doc: relnotes: List all closed issues for 2.3
scripts/release/list_issues.py -o zephyrproject-rtos -r zephyr -s
2020-03-10 -f issues.txt

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:35:56 +02:00
Carles Cufi
3ebb5f339c doc: relnotes: Fix verb tenses
Use past tenses everywhere.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:35:56 +02:00
Carles Cufi
7d17c313d4 doc: relnotes: Extra 2.3 tidbits
Add a few extra tidbits related to boards and APIs.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:35:56 +02:00
Carles Cufi
27b38bd654 doc: relnotes: Document the random subsystem
Add the single relevant change to the random subsystem.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-05 20:35:56 +02:00
Robert Lubos
370dfe088f net: sockets: Fix socket ctx check in usermode
When `z_get_fd_obj_and_vtable()` function returns NULL (no valid entry
in the FD table for the socket), there is no need for further usermode
checks on the `ctx` pointer, as there is nothing to invalidate in that
case.

Fixes #25990
Fixes #25991

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-05 18:34:25 +02:00
Peter Bigot
1af0428c3d samples: usb: mass: set storage device for FatFS
Left unset it becomes the first partition, which is not what's used
for littlefs, and specifically isn't on the external flash for
nrf52840dk_nrf52840.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:44:39 +02:00
Peter Bigot
d32b4bd210 samples: usb: mass: fix to support FatFS on external file system
The flash interface header needs to be available regardless of
selected filesystem implementation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:44:39 +02:00
Peter Bigot
06afe554c9 tests: kernel: timer_api: compensate inaccurate conversion
When millisecond/tick conversion is not exact tick delta's are
dependent on the initial tick value.  In those cases exact comparisons
need to also allow an adjacent value.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:14:48 +02:00
Peter Bigot
b22cef027f tests: kernel: timer_api: compensate for fast clocks
When HFCLK has a slew making it faster than LFCLK the busy wait can
expire before the timer fires.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:14:48 +02:00
Peter Bigot
365fd524cd tests: kernel: timer_api: use slew for duration timer test
Reduce the duration of the timer test so that it will fire before the
busywait elapses even in the worst case of slew between the tick and
busy-wait clocks.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:14:48 +02:00
Peter Bigot
ac94ffedce tests: kernel: timer_api: use slew for remaining timer threshold
This test sets a timer using one clock, waits using a second clock,
then sees whether the remaining time is the expected value.  When the
two clocks are skewed the comparison requires a threshold.  Provide a
means to estimate the maximum expected error.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:14:48 +02:00
Anas Nashif
cab4ffcf40 doc: release-notes: add x86/kernel sections
Amend both kernel and x86 sections and remove unchanged sections in
other subsystems.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-05 17:12:22 +02:00
Torsten Rasmussen
61e79bb1eb doc: updated to reflect changes introduced with Zephyr CMake package
This commit updates the Zephyr documentation with changes introduced
by Zephyr CMake package.

It removes 'zephyr-env.sh/cmd' where no longer needed, and updates
boilerplate inclusion to find_package.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-04 22:12:03 +02:00
David Brown
b32b5e151a doc: security: Release CVEs from embargo
These CVEs have been released from embargo.  Include details in the v2.3
release notes, and in the vulnerabilities document.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-06-04 22:11:31 +02:00
Julien D'Ascenzio
37e50a6775 driver: timer: stm32_lptim: fix excess ticks
Some ticks are counted additionally when the autoreload
interrupts were too close together.
This patch improve the counts of the clock cycle.
lptim_fired worked badly in particular because the flag ARRM
was not raised when the interrupt was forced.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-06-04 22:10:45 +02:00
Julien D'Ascenzio
01ff7ba6e1 driver: timer: stm32_lptim: fix deadlock when waiting ARROK flag
If ticks is K_TICKS_FOREVER the register autoreload isn't set.
So, on the next call to the z_clock_set_timeout function
the wait for the flag ARROK will be infinite.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-06-04 22:10:45 +02:00
Wayne Ren
ea7140ba63 doc: add the ARC part for release 2.3
add the ARC processor related part for release 2.3

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-06-04 22:09:54 +02:00
Krzysztof Chruscinski
c61dfdc680 tests: drivers: clock_control: nrf: Disable calibration in LFRC test
When test is performed, it assumes that no other entity is changing
the state of the clock. That was not true because calibration was
turning on/off high frequency clock.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-04 11:20:01 +02:00
Krzysztof Chruscinski
dc9d373eab drivers: clock_control: nrf: Allow calibration disabling
Allow to disable calibration even though RC is used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-04 11:20:01 +02:00
Maureen Helm
afd31e9091 doc: release notes: Fixup openisa BLE changes in 2.3 release notes
Fixes up the 2.3 release notes to clarify 2 Mbps PHY support in the
openisa BLE link layer.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-04 10:29:00 +02:00
Maureen Helm
38a8f9c247 doc: release notes: Fill in 2.3 drivers section
Adds 2.3 release notes for all remaining driver classes.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-04 10:29:00 +02:00
Maureen Helm
900329ce08 doc: release notes: Use past tense in 2.3 drivers section
Edits the 2.3 release notes drivers section to use past tense instead of
present tense.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-04 10:29:00 +02:00
Carles Cufi
98d8a90f53 release: Zephyr 2.3.0-rc2
Set version to 2.3.0-rc2.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-03 23:56:21 +02:00
Andrew Boie
c951d71eba net: check permissions on net contexts
The original sockets system calls used file descriptors which
were actually net_context pointers. For all socket system calls,
any calls from user mode would check if the caller had permission
to use the net context.

This was later changed to not stuff net_context pointers into file
descriptors, but all the permission checking was unintentionally
lost, allowing all threads on the system to
read/write all socket file descriptors in the system at will, with
no way to isolate applications running on the same microcontroller
from each other's network activity.

This patch restores the permission checks on network context objects
for socket system calls that originated from user mode.

The call to z_object_recycle() was never removed from
zsock_socket_internal(); this is again leveraged to grant the
caller who opened the socket permission on the net_context
associated with the returned file descriptor.

To ensure that all socket calls do this checking, all uses of
z_get_fd_obj_and_vtable() have been routed through get_sock_vtable().

Objects have initialization state set and thread permissions
reset to just the caller in common zsock_socket() code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
8ea273b44a net: socketpair: fix user mode access
The socketpair file descriptor context objects are heap allocated
and not drawn from a static pool. Register these as kernel objects
when we create them if user mode is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
be919d3bf7 userspace: improve dynamic object allocation
We now have a low-level function z_dynamic_object_create()
which is not a system call and is used for installing
kernel objects that are not supported by k_object_alloc().

Checking for valid object type enumeration values moved
completely to the implementation function.

A few debug messages and comments were improved.

Futexes and sys_mutexes are now properly excluded from
dynamic generation.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
9f63a0a0a0 net: lib: remove socket-specific recycle calls
This is just done in common code now.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
87480cd4fb fdtable: init fd context objects
Anytime a file descriptor context object is updated, we need to
reset its access permissions and initialization state. This
is the most centralized place to do it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
4482f83cdb tests: net: tcp: test zsock_get_context_object
Add test case to prove that this new API works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
9a27ba57bb tests: net_mgmt: grant socket access
This socket is shared by all the test cases which run in
different threads. Just make it a global object here.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
04bba6772b net: sockets: add API to fetch an fd's ctx object
Zephyr running on MPU devices have a different memory model than
process-oriented OSes like Linux and require a method to set
kernel object permissions on a file descriptor's underlying
context object. Add this, and a test to show that it is working.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
fed960b94a net: tag net socket objects
Used for permission validation when accessing the associated file
descriptors from user mode.

There often get defined in implementation code, expand the search
to look in drivers/ and subsys/net/.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
299ec8f1b5 userspace: net sockets are kernel objects
Any data structure declaration tagged with __net_socket will end up
in the kernel object table with type K_OBJ_NET_SOCKET. These all
correspond to objects which are associated with socket file
descriptors and can handle the socket vtable API.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
5960119f16 scripts: parse_syscalls: generalize struct tags
Now we can build up lists of data structures matching a list
of particular tags, with __subsystem being just one case.

Relax searches to also look inside C files, since struct
prototypes may be declared there as well.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
455e178b3b scripts: gen_kobject_list: generalize obj alloc
Instead of handling this ad hoc, generalize which kobject
types can be allocated.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
378024c510 userspace: add z_is_in_user_syscall()
Certain types of system call validation may need to be pushed
deeper in the implementation and not performed in the verification
function. If such checks are only pertinent when the caller was
from user mode, we need an API to detect this situation.

This is implemented by having thread->syscall_frame be non-NULL
only while a user system call is in progress. The template for the
system call marshalling functions is changed to clear this value
on exit.

A test is added to prove that this works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
64c8189ab0 userspace: fix bad ssf pointer on bad/no syscall
This was passing along _current->ssf, but these types of bad
syscalls do not go through the z_mrsh mechanism and was
passing stale data.

We have the syscall stack frame already as an argument,
propagate that so it works properly.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie
36e70afcb5 kernel: fix k_object_free() spelling
This was supposed to match definitions if dynamic objects
are turned on.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Kumar Gala
ff29d306c9 net: tcp2: Fix compile failure on native_posix_64
Need to use %zd in formatter string for net_pkt_get_len since it returns
a size_t otherwise we get something like:

	error: format ‘%d’ expects argument of type ‘int’, but argument
	3 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-03 22:29:16 +02:00
Torsten Rasmussen
d585cdd185 doc: release notes: add Zephyr CMake package to release notes
This commit fills the Build and Infrastructure section with the Zephyr
CMake package enhancement.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Carles Cufí <carles.cufi@nordicsemi.no>
2020-06-03 18:38:30 +02:00
Jukka Rissanen
a2f0a9effe net: sockets: Fix sendmsg() user mode param checks for aux data
If we are calling sendmsg() without any aux data, then msg_controllen
is 0 and msg_control is NULL. Check these allowed values properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Jukka Rissanen
d3dde1ad1c net: sockets: Fix sendmsg() user mode param checks for dst address
If we are calling sendmsg() for a connected socket, then msg_namelen
is 0 and msg_name is NULL. Check these allowed values properly.

Also modify unit tests so that we test this scenario.

Fixes #25925

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Christopher Friedt
79728a63ab tests: socket: socketpair: init param before passing by ref
Fixes #25797
Coverity-CID: 210607

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt
3f30ce21cb tests: socket: socketpair: init param before passing by ref
Fixes #25796
Coverity-CID: 210579

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt
2715357e63 net: socket: socketpair: initialize after NULL check
Fixes #25788
Coverity-CID: 210581

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt
fb9f6a482f samples: sockets: socketpair: mitigate negative index
Fixes #25780
Coverity-CID: 210612

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00