There is no need to call rwb->rhreloade() when nblocks is 0,
and some platform(eg: BES) has the limit that the parameter
of len in pltatform flash read function cant't be 0.
issue:
in rwb_wrflush():
memmove(rwb->wrbuffer + padblocks * rwb->blocksize,
rwb->wrbuffer, rwb->wrnblocks * rwb->blocksize);
when the offest from rwb->wrblockstart to startblock plus rwb->wrnblocks is greater
than rwb->wralignblocks, it will be causing memory overflow since rwb->wrbuffer is
allocated rwb.wrmaxblock(rwb.wralignblocks) blocks.
fix:
Let us ensure that the wrblockstart in rwbuffer must be aligned according to
wralignblocks after writing, so there is no need to perform memmove when flushing
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
when the offest from rwb->wrblockstart to startblock
plus rwb->wrnblocks is greater than rwb->wralignblocks,
it will be causing memory overflow since rwb->wrbuffer is
allocated rwb.wrmaxblock(rwb.wralignblocks) blocks.
Use private naming to avoid conflicts with user applications
In file included from libuv/src/unix/internal.h:25,
from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
57 | #define container_of(ptr, type, member) \
|
In file included from nuttx/include/nuttx/list.h:47,
from nuttx/include/nuttx/tls.h:40,
from nuttx/include/nuttx/sched.h:48,
from nuttx/include/nuttx/arch.h:87,
from nuttx/include/nuttx/userspace.h:35,
from nuttx/include/nuttx/mm/mm.h:30,
from nuttx/include/nuttx/kmalloc.h:34,
from nuttx/include/nuttx/lib/lib.h:31,
from nuttx/include/stdio.h:35,
from apps/system/libuv/libuv/include/uv.h:59,
from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
48 | #define container_of(ptr, type, member) \
|
Signed-off-by: chao an <anchao@lixiang.com>
The driver's main purpose is to support the porting of the open source
component optee_client (https://github.com/OP-TEE/optee_client) to nttux.
The basic function of the driver module is to convert the REE application layer data and send it to the TEE through rpmsg.
The main functions include
1 driver registration.
we need to register a device driver(/dev/tee0) through optee_register function.
2 open the driver
3 ioctl the driver
The ioctl command passes different parameters and commands, and interacts with the TEE through rpmsg.
4 close the driver
Signed-off-by: hujun5 <hujun5@xiaomi.com>
It may cause out_of_bounds when two side have different configuartion
on NAME_MAX and FS_LARGEFILE(affects size of blkcnt_t)
Signed-off-by: liaoao <liaoao@xiaomi.com>
it may cause use after free if server has removed block device before calling
its operations,such as:
server: rm /dev/testrpmsgblk
client: ls /dev/testrpmsgblk
Signed-off-by: liaoao <liaoao@xiaomi.com>
A segmentfault might happen when read/write/unlink ops called without an open
ops called because it bind ept's ops in rpmsgblk_open_handler.
proxy> rm /dev/ram1
segmentfault
proxy> ls /dev/ram1
segmentfault
Signed-off-by: liaoao <liaoao@xiaomi.com>
In a multi-core heterogeneous architecture, tun device nodes of protocol
stack core can be accessed by other cores through ioctl
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
In function ‘rpmsgblk_unlink_handler’:
misc/rpmsgblk_server.c:340:36: error: ‘const struct block_operations’ has no member named ‘unlink’
340 | msg->header.result = server->bops->unlink(server->blknode);
|
Signed-off-by: chao an <anchao@xiaomi.com>
The default mode for Rpmsgdev is to read/write data as long as possible for
caller, this mode does not apply to tun devices, tun devices can read and
write only one complete ip packet at a time.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
use workqueue for rpmsgdev poll notify to prevent
calling rpmsgdev_poll_cb in interrupt context which
will try to hold mutex in rpmsg_send
Signed-off-by: liaoao <liaoao@xiaomi.com>
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)
------------------
How to test
From within nuttx/. Configure:
cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja
(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja
This uses ninja generator (install with sudo apt install ninja-build). To build:
$ cmake --build build
menuconfig:
$ cmake --build build -t menuconfig
--------------------------
2. cmake/build: reformat the cmake style by cmake-format
https://github.com/cheshirekow/cmake_format
$ pip install cmakelang
$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done
Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
Directly return -ENOTTY in rpmsgxxx_ioctl() when the command is
not supported to avoid fdsan command FIOC_SETTAG and FIOC_GETTAG
pass to the rpmsg dev/mtd/blk server with CONFIG_FDSAN enabled.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
1. rpmsgdev ioctl: should assgin back the client return value to
cookie->result, then this return value can be returned to the
application;
2. rpmsgdev seek: the type "off_t" may be 64bit, so modify the offset
in "struct rpmsgdev_lseek" to int64_t too;
3. rpmsgdev_seek: the rpmsgdev_seek in client should update the
filep->f_pos after the seek operation;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>