Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
64538858
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64538858
编写于
8月 06, 2018
作者:
R
Ralf Jung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
actually, reentrant uninitialized mutex acquisition is outright UB
上级
ab3e4a27
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
15 addition
and
21 deletion
+15
-21
src/libstd/io/lazy.rs
src/libstd/io/lazy.rs
+2
-3
src/libstd/sys/unix/args.rs
src/libstd/sys/unix/args.rs
+2
-3
src/libstd/sys/unix/os.rs
src/libstd/sys/unix/os.rs
+2
-3
src/libstd/sys_common/at_exit_imp.rs
src/libstd/sys_common/at_exit_imp.rs
+2
-3
src/libstd/sys_common/mutex.rs
src/libstd/sys_common/mutex.rs
+3
-3
src/libstd/sys_common/thread_local.rs
src/libstd/sys_common/thread_local.rs
+2
-3
src/libstd/thread/mod.rs
src/libstd/thread/mod.rs
+2
-3
未找到文件。
src/libstd/io/lazy.rs
浏览文件 @
64538858
...
...
@@ -29,9 +29,8 @@ impl<T: Send + Sync + 'static> Lazy<T> {
/// Safety: `init` must not call `get` on the variable that is being
/// initialized.
pub
const
unsafe
fn
new
(
init
:
fn
()
->
Arc
<
T
>
)
->
Lazy
<
T
>
{
// `lock` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `lock` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
Lazy
{
lock
:
Mutex
::
new
(),
ptr
:
Cell
::
new
(
ptr
::
null_mut
()),
...
...
src/libstd/sys/unix/args.rs
浏览文件 @
64538858
...
...
@@ -80,9 +80,8 @@ mod imp {
static
mut
ARGC
:
isize
=
0
;
static
mut
ARGV
:
*
const
*
const
u8
=
ptr
::
null
();
// `ENV_LOCK` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `ENV_LOCK` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
static
LOCK
:
Mutex
=
Mutex
::
new
();
pub
unsafe
fn
init
(
argc
:
isize
,
argv
:
*
const
*
const
u8
)
{
...
...
src/libstd/sys/unix/os.rs
浏览文件 @
64538858
...
...
@@ -33,9 +33,8 @@
use
vec
;
const
TMPBUF_SZ
:
usize
=
128
;
// `ENV_LOCK` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `ENV_LOCK` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
static
ENV_LOCK
:
Mutex
=
Mutex
::
new
();
...
...
src/libstd/sys_common/at_exit_imp.rs
浏览文件 @
64538858
...
...
@@ -23,9 +23,8 @@
// on poisoning and this module needs to operate at a lower level than requiring
// the thread infrastructure to be in place (useful on the borders of
// initialization/destruction).
// `LOCK` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `LOCK` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
static
LOCK
:
Mutex
=
Mutex
::
new
();
static
mut
QUEUE
:
*
mut
Queue
=
ptr
::
null_mut
();
...
...
src/libstd/sys_common/mutex.rs
浏览文件 @
64538858
...
...
@@ -24,9 +24,9 @@ impl Mutex {
///
/// Behavior is undefined if the mutex is moved after it is
/// first used with any of the functions below.
/// Also,
the mutex might not be fully functional without calling
///
`init`! For example, on unix, the mutex is reentrant
///
until `init` reconfigures it appropriately
.
/// Also,
until `init` is called, behavior is undefined if this
///
mutex is ever used reentrantly, i.e., `raw_lock` or `try_lock`
///
are called by the thread currently holding the lock
.
pub
const
fn
new
()
->
Mutex
{
Mutex
(
imp
::
Mutex
::
new
())
}
/// Prepare the mutex for use.
...
...
src/libstd/sys_common/thread_local.rs
浏览文件 @
64538858
...
...
@@ -161,9 +161,8 @@ unsafe fn lazy_init(&self) -> usize {
// Additionally a 0-index of a tls key hasn't been seen on windows, so
// we just simplify the whole branch.
if
imp
::
requires_synchronized_create
()
{
// `INIT_LOCK` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `INIT_LOCK` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
static
INIT_LOCK
:
Mutex
=
Mutex
::
new
();
let
_
guard
=
INIT_LOCK
.lock
();
let
mut
key
=
self
.key
.load
(
Ordering
::
SeqCst
);
...
...
src/libstd/thread/mod.rs
浏览文件 @
64538858
...
...
@@ -940,9 +940,8 @@ pub fn park_timeout(dur: Duration) {
impl
ThreadId
{
// Generate a new unique thread ID.
fn
new
()
->
ThreadId
{
// `GUARD` is never initialized fully, so this mutex is reentrant!
// Do not use it in a way that might be reentrant, that could lead to
// aliasing `&mut`.
// `GUARD` is never initialized fully, so it is UB to attempt to
// acquire this mutex reentrantly!
static
GUARD
:
mutex
::
Mutex
=
mutex
::
Mutex
::
new
();
static
mut
COUNTER
:
u64
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录