一些安全性的增强
This commit is contained in:
@@ -130,12 +130,12 @@ int app_load(const char *name, uenv_t *cur_env)
|
||||
{
|
||||
goto end_del_obj;
|
||||
}
|
||||
tag = thread_msg_buf_set(hd_thread, (void *)(ram_base + app->i.ram_size));
|
||||
tag = thread_bind_task(hd_thread, hd_task);
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
goto end_del_obj;
|
||||
}
|
||||
tag = thread_bind_task(hd_thread, hd_task);
|
||||
tag = thread_msg_buf_set(hd_thread, (void *)(ram_base + app->i.ram_size));
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
goto end_del_obj;
|
||||
|
||||
@@ -29,12 +29,7 @@ int u_thread_create(obj_handler_t *th_hd, void *stack, umword_t stack_size, void
|
||||
handler_free(th1_hd);
|
||||
return msg_tag_get_prot(tag);
|
||||
}
|
||||
tag = thread_msg_buf_set(th1_hd, msg_buf);
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
handler_free_umap(th1_hd);
|
||||
return msg_tag_get_prot(tag);
|
||||
}
|
||||
|
||||
tag = thread_exec_regs(th1_hd, (umword_t)thread_func, (umword_t)stack + stack_size - sizeof(void *), RAM_BASE(), 0);
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
@@ -47,6 +42,12 @@ int u_thread_create(obj_handler_t *th_hd, void *stack, umword_t stack_size, void
|
||||
handler_free_umap(th1_hd);
|
||||
return msg_tag_get_prot(tag);
|
||||
}
|
||||
tag = thread_msg_buf_set(th1_hd, msg_buf);
|
||||
if (msg_tag_get_prot(tag) < 0)
|
||||
{
|
||||
handler_free_umap(th1_hd);
|
||||
return msg_tag_get_prot(tag);
|
||||
}
|
||||
*th_hd = th1_hd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file namespace.c
|
||||
* @author zhangzheng (1358745329@qq.com)
|
||||
* @brief
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-11-28
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <u_types.h>
|
||||
#include <string.h>
|
||||
@@ -81,6 +81,12 @@ int namespace_query(const char *path, obj_handler_t *hd)
|
||||
char *split_str = strstr(path, ns.ne_list[i].path);
|
||||
if (split_str && (split_str == path))
|
||||
{
|
||||
msg_tag_t tag = task_obj_valid(TASK_THIS, ns.ne_list[i].hd);
|
||||
if (msg_tag_get_val(tag) != 1)
|
||||
{
|
||||
// 对象变为无效,删除该条记录
|
||||
ns.ne_list[i].hd = HANDLER_INVALID;
|
||||
}
|
||||
*hd = ns.ne_list[i].hd;
|
||||
return (int)(strlen(ns.ne_list[i].path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user