Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
a7eb2d81
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a7eb2d81
编写于
4月 22, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
4月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] not jump to routine stack when use asan
上级
3942c226
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
38 addition
and
1 deletion
+38
-1
deps/oblib/src/common/ob_common_utility.cpp
deps/oblib/src/common/ob_common_utility.cpp
+11
-0
deps/oblib/src/lib/coro/co_routine.cpp
deps/oblib/src/lib/coro/co_routine.cpp
+22
-1
deps/oblib/src/lib/coro/co_routine.h
deps/oblib/src/lib/coro/co_routine.h
+1
-0
deps/oblib/src/lib/coro/routine.h
deps/oblib/src/lib/coro/routine.h
+4
-0
未找到文件。
deps/oblib/src/common/ob_common_utility.cpp
浏览文件 @
a7eb2d81
...
@@ -118,6 +118,7 @@ int check_stack_overflow(bool& is_overflow, int64_t reserved_size /* default equ
...
@@ -118,6 +118,7 @@ int check_stack_overflow(bool& is_overflow, int64_t reserved_size /* default equ
int
get_stackattr
(
void
*&
stackaddr
,
size_t
&
stacksize
)
int
get_stackattr
(
void
*&
stackaddr
,
size_t
&
stacksize
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
#ifndef OB_USE_ASAN
if
(
OB_LIKELY
(
CO_IS_ENABLED
()))
{
if
(
OB_LIKELY
(
CO_IS_ENABLED
()))
{
auto
cls
=
reinterpret_cast
<
common
::
ObLocalStore
*>
(
CO_CURRENT
().
get_context
().
get_local_store
());
auto
cls
=
reinterpret_cast
<
common
::
ObLocalStore
*>
(
CO_CURRENT
().
get_context
().
get_local_store
());
stackaddr
=
cls
->
stack_addr_
;
stackaddr
=
cls
->
stack_addr_
;
...
@@ -125,6 +126,11 @@ int get_stackattr(void*& stackaddr, size_t& stacksize)
...
@@ -125,6 +126,11 @@ int get_stackattr(void*& stackaddr, size_t& stacksize)
}
else
if
(
OB_LIKELY
(
g_stackaddr
!=
nullptr
))
{
}
else
if
(
OB_LIKELY
(
g_stackaddr
!=
nullptr
))
{
stackaddr
=
g_stackaddr
;
stackaddr
=
g_stackaddr
;
stacksize
=
g_stacksize
;
stacksize
=
g_stacksize
;
#else
if
(
OB_LIKELY
(
g_stackaddr
!=
nullptr
))
{
stackaddr
=
g_stackaddr
;
stacksize
=
g_stacksize
;
#endif
}
else
{
}
else
{
pthread_attr_t
attr
;
pthread_attr_t
attr
;
if
(
OB_UNLIKELY
(
0
!=
pthread_getattr_np
(
pthread_self
(),
&
attr
)))
{
if
(
OB_UNLIKELY
(
0
!=
pthread_getattr_np
(
pthread_self
(),
&
attr
)))
{
...
@@ -147,6 +153,7 @@ int get_stackattr(void*& stackaddr, size_t& stacksize)
...
@@ -147,6 +153,7 @@ int get_stackattr(void*& stackaddr, size_t& stacksize)
void
set_stackattr
(
void
*
stackaddr
,
size_t
stacksize
)
void
set_stackattr
(
void
*
stackaddr
,
size_t
stacksize
)
{
{
#ifndef OB_USE_ASAN
if
(
CO_IS_ENABLED
())
{
if
(
CO_IS_ENABLED
())
{
auto
cls
=
reinterpret_cast
<
common
::
ObLocalStore
*>
(
CO_CURRENT
().
get_context
().
get_local_store
());
auto
cls
=
reinterpret_cast
<
common
::
ObLocalStore
*>
(
CO_CURRENT
().
get_context
().
get_local_store
());
cls
->
stack_addr_
=
stackaddr
;
cls
->
stack_addr_
=
stackaddr
;
...
@@ -155,6 +162,10 @@ void set_stackattr(void* stackaddr, size_t stacksize)
...
@@ -155,6 +162,10 @@ void set_stackattr(void* stackaddr, size_t stacksize)
g_stackaddr
=
(
char
*
)
stackaddr
;
g_stackaddr
=
(
char
*
)
stackaddr
;
g_stacksize
=
stacksize
;
g_stacksize
=
stacksize
;
}
}
#else
g_stackaddr
=
(
char
*
)
stackaddr
;
g_stacksize
=
stacksize
;
#endif
}
}
ObFatalErrExtraInfoGuard
::
ObFatalErrExtraInfoGuard
()
ObFatalErrExtraInfoGuard
::
ObFatalErrExtraInfoGuard
()
...
...
deps/oblib/src/lib/coro/co_routine.cpp
浏览文件 @
a7eb2d81
...
@@ -71,9 +71,12 @@ int CoRoutine::resume(CoRoutine& current)
...
@@ -71,9 +71,12 @@ int CoRoutine::resume(CoRoutine& current)
running_tsc_
=
co_rdtscp
();
running_tsc_
=
co_rdtscp
();
assert
(
cc_
.
get_ctx
());
assert
(
cc_
.
get_ctx
());
#ifndef OB_USE_ASAN
transfer_t
transfer
=
jump_fcontext
(
cc_
.
get_ctx
(),
this
);
transfer_t
transfer
=
jump_fcontext
(
cc_
.
get_ctx
(),
this
);
cc_
.
get_ctx
()
=
transfer
.
fctx
;
cc_
.
get_ctx
()
=
transfer
.
fctx
;
#else
start_without_jump
();
#endif
return
ret
;
return
ret
;
}
}
...
@@ -142,6 +145,24 @@ void CoRoutine::__start(transfer_t from)
...
@@ -142,6 +145,24 @@ void CoRoutine::__start(transfer_t from)
OB_ASSERT
(
0
);
OB_ASSERT
(
0
);
}
}
void
CoRoutine
::
start_without_jump
()
{
int
ret
=
OB_SUCCESS
;
CoRoutine
&
routine
=
*
this
;
routine
.
idx_
=
alloc_coidx
();
routine
.
set_run_status
(
RunStatus
::
RUNNING
);
routine
.
at_create
();
MemoryContext
*
mem_context
=
GET_TSI0
(
MemoryContext
);
assert
(
mem_context
!=
nullptr
&&
*
mem_context
!=
nullptr
);
WITH_CONTEXT
(
*
mem_context
)
{
routine
.
run
();
}
routine
.
at_exit
();
free_coidx
(
routine
.
idx_
);
routine
.
set_run_status
(
RunStatus
::
FINISHED
);
}
int
CoRoutine
::
at_create
()
int
CoRoutine
::
at_create
()
{
{
CVC
.
at_routine_create
(
get_crls_buffer
());
CVC
.
at_routine_create
(
get_crls_buffer
());
...
...
deps/oblib/src/lib/coro/co_routine.h
浏览文件 @
a7eb2d81
...
@@ -202,6 +202,7 @@ private:
...
@@ -202,6 +202,7 @@ private:
CoRoutine
();
CoRoutine
();
static
void
__start
(
boost
::
context
::
detail
::
transfer_t
from
);
static
void
__start
(
boost
::
context
::
detail
::
transfer_t
from
);
void
start_without_jump
();
private:
private:
CoIdx
idx_
;
CoIdx
idx_
;
...
...
deps/oblib/src/lib/coro/routine.h
浏览文件 @
a7eb2d81
...
@@ -56,11 +56,15 @@ namespace this_routine {
...
@@ -56,11 +56,15 @@ namespace this_routine {
/// their execution.
/// their execution.
OB_INLINE
void
usleep
(
uint32_t
usec
)
OB_INLINE
void
usleep
(
uint32_t
usec
)
{
{
#ifndef OB_USE_ASAN
if
(
!
this_thread
::
is_monopoly
()
&&
coro
::
is_enabled
())
{
if
(
!
this_thread
::
is_monopoly
()
&&
coro
::
is_enabled
())
{
coro
::
current
().
usleep
(
usec
);
coro
::
current
().
usleep
(
usec
);
}
else
{
}
else
{
::
usleep
(
usec
);
::
usleep
(
usec
);
}
}
#else
::
usleep
(
usec
);
#endif
}
}
/// \brief Yield to other routines.
/// \brief Yield to other routines.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录