修复objspace数组访问越界的bug

This commit is contained in:
zhangzheng
2023-09-30 14:50:48 +08:00
parent 2fc002f2e1
commit 4827093da7
8 changed files with 30 additions and 7 deletions

View File

@@ -61,6 +61,7 @@ static inline syscall_prot_t syscall_prot_create(uint8_t op, uint8_t prot, obj_h
.op = op,
.prot = prot,
.obj_inx = obj_inx,
.self = 0,
};
}
static inline syscall_prot_t syscall_prot_create4(uint8_t op, uint8_t prot, obj_handler_t obj_inx, uint8_t self)

View File

@@ -7,7 +7,7 @@
#include <pthread.h>
#define HANDLER_START_INX 10 //!< fd开始的值前10个内核保留
#define HANDLER_MAX_NR 64 //!< 单个task最大支持的hd数量
#define HANDLER_MAX_NR 64 //!< 单个task最大支持的hd数量
static umword_t bitmap_handler_alloc[HANDLER_MAX_NR / WORD_BYTES];
static pthread_spinlock_t lock;

View File

@@ -34,8 +34,9 @@ int main(int argc, char *args[])
app_test();
mpu_test();
ipc_test();
thread_press_test();
#endif
// thread_press_test();
kobj_create_press_test();
uenv_t env = *u_get_global_env();
obj_handler_t ipc_hd;
int ret = rpc_creaite_bind_ipc(THREAD_MAIN, NULL, &ipc_hd);

View File

@@ -0,0 +1,20 @@
#include "u_log.h"
#include "u_prot.h"
#include "u_mm.h"
#include "u_factory.h"
#include "u_thread.h"
#include "u_task.h"
#include "u_ipc.h"
#include "u_hd_man.h"
#include <assert.h>
#include <stdio.h>
#include "test.h"
void kobj_create_press_test(void)
{
while (1)
{
msg_tag_t tag = factory_create_ipc(FACTORY_PROT, vpage_create_raw3(KOBJ_ALL_RIGHTS, 0, handler_alloc()));
assert(msg_tag_get_prot(tag) >= 0);
}
}

View File

@@ -14,4 +14,5 @@ void map_test(void);
void ipc_timeout_test(void);
void irq_test(void);
void thread_press_test(void);
void kobj_create_press_test(void);
void sleep_tick(int tick);