gpoulios commented on PR #16309:
URL: https://github.com/apache/nuttx/pull/16309#issuecomment-2862158650
> @gpoulios why mark the patch to draft?
3 reasons:
- I don't see this getting @raiden00pl 's approval so I thought I'd try
re-writing some parts of the code but it turns out I can't. On the contrary,
I'm thinking of putting back `reg_pair_to_64` and co. as they are [actually
licensed under
BSD](https://github.com/tiiuae/imx-optee-os/blob/8dd180b6d149c1e1314b5869697179f665bd9ca3/lib/libutils/ext/include/util.h#L169).
- I need to guard all list accesses around a mutex. Btw, @xiaoxiang781216
would you rather see this as a new commit or an amendment to the existing one?
- I noticed the IDs in `tee_ioctl_shm_alloc_data`,
`tee_ioctl_shm_register_fd_data`, and `tee_ioctl_shm_register_data` are _all_
output parameters (whereas I was using `rdata.id` as input):
https://github.com/apache/nuttx/blob/468c9eacd8fd30817cd683a07a10ead8d2652a0a/include/nuttx/tee.h#L113
https://github.com/apache/nuttx/blob/468c9eacd8fd30817cd683a07a10ead8d2652a0a/include/nuttx/tee.h#L145
https://github.com/apache/nuttx/blob/468c9eacd8fd30817cd683a07a10ead8d2652a0a/include/nuttx/tee.h#L393
@xiaoxiang781216 Do we really need those? I'm having a hard time generating
unique IDs for shared memory registrations. Thinking of the following options:
1. casting the actual buffer address to int32
- not guaranteed to be unique, either because of 64-bit addresses or due
to overall between user and kernel VA space
2. traversing the list to find a free integer ID starting from 0
- needs at least one list traversal on best case, more if `MAX_INT32`
has been reached
3. using list head's ID + 1
- we need to stick to adding new entries at the head of the list but is
efficient
4. using a `shm_nextid` field in `struct optee_priv_data`
- need to guard with mutex (which I'm also doing for list accesses right
now, so not such a big deal)
Leaning towards 3, but would appreciate your thoughts on this.
On the contrary, points for removing the IDs entirely:
- we can also remove this (correct me if I'm wrong)
https://github.com/apache/nuttx/blob/1a8fba827a73bb842a60f86b610470c2f38ad4f4/drivers/misc/optee.c#L586
- it's not like we can prevent duplicate list entries anyways (especially
given we have both user and kernel registrations).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]