Skip to content

zsock_getaddrinfo is not reentrant #8906

@andrewboie

Description

@andrewboie

This uses a global air_addr array for returning values to the user (the struct addrinfo **res parameter)
This memory needs to be allocated off of some heap or memory pool; users of getaddrinfo() will be expecting that they need to call freeaddrinfo(), which is not implemented.

For user mode, this is a little more complicated as we have some gaps:

  • malloc() only exists for newlib and not minimal libc
  • z_thread_malloc() and k_malloc(), by design, do not return memory allocations that are readable from user mode
  • k/sys mem pools are clumsy to specify, it's not possible to take an arbitrarily-sized character buffer and make a mem pool from it

What's needed is a malloc() implementation for the minimal libc. Furthermore for user mode, we need something like z_thread_malloc() where there can be thread-specific pools to draw allocations from, instead of one giant pool that any thread can stomp on (which is what the newlib malloc currently does)

Metadata

Metadata

Assignees

Labels

EnhancementChanges/Updates/Additions to existing features

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions