Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
571ed1fd
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
6
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
571ed1fd
编写于
9月 29, 2018
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Replace krb5_seq_lock with a lockless scheme
Signed-off-by:
N
Trond Myklebust
<
trond.myklebust@hammerspace.com
>
上级
0c1c19f4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
18 deletion
+30
-18
include/linux/sunrpc/gss_krb5.h
include/linux/sunrpc/gss_krb5.h
+2
-1
net/sunrpc/auth_gss/gss_krb5_seal.c
net/sunrpc/auth_gss/gss_krb5_seal.c
+26
-11
net/sunrpc/auth_gss/gss_krb5_wrap.c
net/sunrpc/auth_gss/gss_krb5_wrap.c
+2
-6
未找到文件。
include/linux/sunrpc/gss_krb5.h
浏览文件 @
571ed1fd
...
...
@@ -118,7 +118,8 @@ struct krb5_ctx {
u8
acceptor_integ
[
GSS_KRB5_MAX_KEYLEN
];
};
extern
spinlock_t
krb5_seq_lock
;
extern
u32
gss_seq_send_fetch_and_inc
(
struct
krb5_ctx
*
ctx
);
extern
u64
gss_seq_send64_fetch_and_inc
(
struct
krb5_ctx
*
ctx
);
/* The length of the Kerberos GSS token header */
#define GSS_KRB5_TOK_HDR_LEN (16)
...
...
net/sunrpc/auth_gss/gss_krb5_seal.c
浏览文件 @
571ed1fd
...
...
@@ -68,8 +68,6 @@
# define RPCDBG_FACILITY RPCDBG_AUTH
#endif
DEFINE_SPINLOCK
(
krb5_seq_lock
);
static
void
*
setup_token
(
struct
krb5_ctx
*
ctx
,
struct
xdr_netobj
*
token
)
{
...
...
@@ -124,6 +122,30 @@ setup_token_v2(struct krb5_ctx *ctx, struct xdr_netobj *token)
return
krb5_hdr
;
}
u32
gss_seq_send_fetch_and_inc
(
struct
krb5_ctx
*
ctx
)
{
u32
old
,
seq_send
=
READ_ONCE
(
ctx
->
seq_send
);
do
{
old
=
seq_send
;
seq_send
=
cmpxchg
(
&
ctx
->
seq_send
,
old
,
old
+
1
);
}
while
(
old
!=
seq_send
);
return
seq_send
;
}
u64
gss_seq_send64_fetch_and_inc
(
struct
krb5_ctx
*
ctx
)
{
u64
old
,
seq_send
=
READ_ONCE
(
ctx
->
seq_send
);
do
{
old
=
seq_send
;
seq_send
=
cmpxchg
(
&
ctx
->
seq_send64
,
old
,
old
+
1
);
}
while
(
old
!=
seq_send
);
return
seq_send
;
}
static
u32
gss_get_mic_v1
(
struct
krb5_ctx
*
ctx
,
struct
xdr_buf
*
text
,
struct
xdr_netobj
*
token
)
...
...
@@ -154,9 +176,7 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,
memcpy
(
ptr
+
GSS_KRB5_TOK_HDR_LEN
,
md5cksum
.
data
,
md5cksum
.
len
);
spin_lock
(
&
krb5_seq_lock
);
seq_send
=
ctx
->
seq_send
++
;
spin_unlock
(
&
krb5_seq_lock
);
seq_send
=
gss_seq_send_fetch_and_inc
(
ctx
);
if
(
krb5_make_seq_num
(
ctx
,
ctx
->
seq
,
ctx
->
initiate
?
0
:
0xff
,
seq_send
,
ptr
+
GSS_KRB5_TOK_HDR_LEN
,
ptr
+
8
))
...
...
@@ -174,7 +194,6 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,
.
data
=
cksumdata
};
void
*
krb5_hdr
;
s32
now
;
u64
seq_send
;
u8
*
cksumkey
;
unsigned
int
cksum_usage
;
__be64
seq_send_be64
;
...
...
@@ -185,11 +204,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,
/* Set up the sequence number. Now 64-bits in clear
* text and w/o direction indicator */
spin_lock
(
&
krb5_seq_lock
);
seq_send
=
ctx
->
seq_send64
++
;
spin_unlock
(
&
krb5_seq_lock
);
seq_send_be64
=
cpu_to_be64
(
seq_send
);
seq_send_be64
=
cpu_to_be64
(
gss_seq_send64_fetch_and_inc
(
ctx
));
memcpy
(
krb5_hdr
+
8
,
(
char
*
)
&
seq_send_be64
,
8
);
if
(
ctx
->
initiate
)
{
...
...
net/sunrpc/auth_gss/gss_krb5_wrap.c
浏览文件 @
571ed1fd
...
...
@@ -228,9 +228,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,
memcpy
(
ptr
+
GSS_KRB5_TOK_HDR_LEN
,
md5cksum
.
data
,
md5cksum
.
len
);
spin_lock
(
&
krb5_seq_lock
);
seq_send
=
kctx
->
seq_send
++
;
spin_unlock
(
&
krb5_seq_lock
);
seq_send
=
gss_seq_send_fetch_and_inc
(
kctx
);
/* XXX would probably be more efficient to compute checksum
* and encrypt at the same time: */
...
...
@@ -477,9 +475,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset,
*
be16ptr
++
=
0
;
be64ptr
=
(
__be64
*
)
be16ptr
;
spin_lock
(
&
krb5_seq_lock
);
*
be64ptr
=
cpu_to_be64
(
kctx
->
seq_send64
++
);
spin_unlock
(
&
krb5_seq_lock
);
*
be64ptr
=
cpu_to_be64
(
gss_seq_send64_fetch_and_inc
(
kctx
));
err
=
(
*
kctx
->
gk5e
->
encrypt_v2
)(
kctx
,
offset
,
buf
,
pages
);
if
(
err
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录