Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
157cf649
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
157cf649
编写于
12月 14, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sanitize audit_fd_pair()
* no allocations * return void Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
564f6993
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
49 deletion
+20
-49
fs/pipe.c
fs/pipe.c
+1
-6
include/linux/audit.h
include/linux/audit.h
+4
-5
kernel/auditsc.c
kernel/auditsc.c
+14
-30
net/socket.c
net/socket.c
+1
-8
未找到文件。
fs/pipe.c
浏览文件 @
157cf649
...
@@ -1016,10 +1016,7 @@ int do_pipe_flags(int *fd, int flags)
...
@@ -1016,10 +1016,7 @@ int do_pipe_flags(int *fd, int flags)
goto
err_fdr
;
goto
err_fdr
;
fdw
=
error
;
fdw
=
error
;
error
=
audit_fd_pair
(
fdr
,
fdw
);
audit_fd_pair
(
fdr
,
fdw
);
if
(
error
<
0
)
goto
err_fdw
;
fd_install
(
fdr
,
fr
);
fd_install
(
fdr
,
fr
);
fd_install
(
fdw
,
fw
);
fd_install
(
fdw
,
fw
);
fd
[
0
]
=
fdr
;
fd
[
0
]
=
fdr
;
...
@@ -1027,8 +1024,6 @@ int do_pipe_flags(int *fd, int flags)
...
@@ -1027,8 +1024,6 @@ int do_pipe_flags(int *fd, int flags)
return
0
;
return
0
;
err_fdw:
put_unused_fd
(
fdw
);
err_fdr:
err_fdr:
put_unused_fd
(
fdr
);
put_unused_fd
(
fdr
);
err_read_pipe:
err_read_pipe:
...
...
include/linux/audit.h
浏览文件 @
157cf649
...
@@ -448,7 +448,7 @@ extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mod
...
@@ -448,7 +448,7 @@ extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mod
extern
int
audit_bprm
(
struct
linux_binprm
*
bprm
);
extern
int
audit_bprm
(
struct
linux_binprm
*
bprm
);
extern
void
audit_socketcall
(
int
nargs
,
unsigned
long
*
args
);
extern
void
audit_socketcall
(
int
nargs
,
unsigned
long
*
args
);
extern
int
audit_sockaddr
(
int
len
,
void
*
addr
);
extern
int
audit_sockaddr
(
int
len
,
void
*
addr
);
extern
int
__audit_fd_pair
(
int
fd1
,
int
fd2
);
extern
void
__audit_fd_pair
(
int
fd1
,
int
fd2
);
extern
int
audit_set_macxattr
(
const
char
*
name
);
extern
int
audit_set_macxattr
(
const
char
*
name
);
extern
void
__audit_mq_open
(
int
oflag
,
mode_t
mode
,
struct
mq_attr
*
attr
);
extern
void
__audit_mq_open
(
int
oflag
,
mode_t
mode
,
struct
mq_attr
*
attr
);
extern
void
__audit_mq_sendrecv
(
mqd_t
mqdes
,
size_t
msg_len
,
unsigned
int
msg_prio
,
const
struct
timespec
*
abs_timeout
);
extern
void
__audit_mq_sendrecv
(
mqd_t
mqdes
,
size_t
msg_len
,
unsigned
int
msg_prio
,
const
struct
timespec
*
abs_timeout
);
...
@@ -464,11 +464,10 @@ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
...
@@ -464,11 +464,10 @@ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
if
(
unlikely
(
!
audit_dummy_context
()))
if
(
unlikely
(
!
audit_dummy_context
()))
__audit_ipc_obj
(
ipcp
);
__audit_ipc_obj
(
ipcp
);
}
}
static
inline
int
audit_fd_pair
(
int
fd1
,
int
fd2
)
static
inline
void
audit_fd_pair
(
int
fd1
,
int
fd2
)
{
{
if
(
unlikely
(
!
audit_dummy_context
()))
if
(
unlikely
(
!
audit_dummy_context
()))
return
__audit_fd_pair
(
fd1
,
fd2
);
__audit_fd_pair
(
fd1
,
fd2
);
return
0
;
}
}
static
inline
void
audit_ipc_set_perm
(
unsigned
long
qbytes
,
uid_t
uid
,
gid_t
gid
,
mode_t
mode
)
static
inline
void
audit_ipc_set_perm
(
unsigned
long
qbytes
,
uid_t
uid
,
gid_t
gid
,
mode_t
mode
)
{
{
...
@@ -537,7 +536,7 @@ extern int audit_signals;
...
@@ -537,7 +536,7 @@ extern int audit_signals;
#define audit_ipc_set_perm(q,u,g,m) ((void)0)
#define audit_ipc_set_perm(q,u,g,m) ((void)0)
#define audit_bprm(p) ({ 0; })
#define audit_bprm(p) ({ 0; })
#define audit_socketcall(n,a) ((void)0)
#define audit_socketcall(n,a) ((void)0)
#define audit_fd_pair(n,a) (
{ 0; }
)
#define audit_fd_pair(n,a) (
(void)0
)
#define audit_sockaddr(len, addr) ({ 0; })
#define audit_sockaddr(len, addr) ({ 0; })
#define audit_set_macxattr(n) do { ; } while (0)
#define audit_set_macxattr(n) do { ; } while (0)
#define audit_mq_open(o,m,a) ((void)0)
#define audit_mq_open(o,m,a) ((void)0)
...
...
kernel/auditsc.c
浏览文件 @
157cf649
...
@@ -131,11 +131,6 @@ struct audit_aux_data_execve {
...
@@ -131,11 +131,6 @@ struct audit_aux_data_execve {
struct
mm_struct
*
mm
;
struct
mm_struct
*
mm
;
};
};
struct
audit_aux_data_fd_pair
{
struct
audit_aux_data
d
;
int
fd
[
2
];
};
struct
audit_aux_data_pids
{
struct
audit_aux_data_pids
{
struct
audit_aux_data
d
;
struct
audit_aux_data
d
;
pid_t
target_pid
[
AUDIT_AUX_PIDS
];
pid_t
target_pid
[
AUDIT_AUX_PIDS
];
...
@@ -241,6 +236,7 @@ struct audit_context {
...
@@ -241,6 +236,7 @@ struct audit_context {
struct
mq_attr
attr
;
struct
mq_attr
attr
;
}
mq_open
;
}
mq_open
;
};
};
int
fds
[
2
];
#if AUDIT_DEBUG
#if AUDIT_DEBUG
int
put_count
;
int
put_count
;
...
@@ -1382,11 +1378,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
...
@@ -1382,11 +1378,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
audit_log_execve_info
(
context
,
&
ab
,
axi
);
audit_log_execve_info
(
context
,
&
ab
,
axi
);
break
;
}
break
;
}
case
AUDIT_FD_PAIR
:
{
struct
audit_aux_data_fd_pair
*
axs
=
(
void
*
)
aux
;
audit_log_format
(
ab
,
"fd0=%d fd1=%d"
,
axs
->
fd
[
0
],
axs
->
fd
[
1
]);
break
;
}
case
AUDIT_BPRM_FCAPS
:
{
case
AUDIT_BPRM_FCAPS
:
{
struct
audit_aux_data_bprm_fcaps
*
axs
=
(
void
*
)
aux
;
struct
audit_aux_data_bprm_fcaps
*
axs
=
(
void
*
)
aux
;
audit_log_format
(
ab
,
"fver=%x"
,
axs
->
fcap_ver
);
audit_log_format
(
ab
,
"fver=%x"
,
axs
->
fcap_ver
);
...
@@ -1416,6 +1407,15 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
...
@@ -1416,6 +1407,15 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
if
(
context
->
type
)
if
(
context
->
type
)
show_special
(
context
,
&
call_panic
);
show_special
(
context
,
&
call_panic
);
if
(
context
->
fds
[
0
]
>=
0
)
{
ab
=
audit_log_start
(
context
,
GFP_KERNEL
,
AUDIT_FD_PAIR
);
if
(
ab
)
{
audit_log_format
(
ab
,
"fd0=%d fd1=%d"
,
context
->
fds
[
0
],
context
->
fds
[
1
]);
audit_log_end
(
ab
);
}
}
if
(
context
->
sockaddr_len
)
{
if
(
context
->
sockaddr_len
)
{
ab
=
audit_log_start
(
context
,
GFP_KERNEL
,
AUDIT_SOCKADDR
);
ab
=
audit_log_start
(
context
,
GFP_KERNEL
,
AUDIT_SOCKADDR
);
if
(
ab
)
{
if
(
ab
)
{
...
@@ -1696,6 +1696,7 @@ void audit_syscall_exit(int valid, long return_code)
...
@@ -1696,6 +1696,7 @@ void audit_syscall_exit(int valid, long return_code)
context
->
target_sid
=
0
;
context
->
target_sid
=
0
;
context
->
sockaddr_len
=
0
;
context
->
sockaddr_len
=
0
;
context
->
type
=
0
;
context
->
type
=
0
;
context
->
fds
[
0
]
=
-
1
;
kfree
(
context
->
filterkey
);
kfree
(
context
->
filterkey
);
context
->
filterkey
=
NULL
;
context
->
filterkey
=
NULL
;
tsk
->
audit_context
=
context
;
tsk
->
audit_context
=
context
;
...
@@ -2291,29 +2292,12 @@ void audit_socketcall(int nargs, unsigned long *args)
...
@@ -2291,29 +2292,12 @@ void audit_socketcall(int nargs, unsigned long *args)
* @fd1: the first file descriptor
* @fd1: the first file descriptor
* @fd2: the second file descriptor
* @fd2: the second file descriptor
*
*
* Returns 0 for success or NULL context or < 0 on error.
*/
*/
int
__audit_fd_pair
(
int
fd1
,
int
fd2
)
void
__audit_fd_pair
(
int
fd1
,
int
fd2
)
{
{
struct
audit_context
*
context
=
current
->
audit_context
;
struct
audit_context
*
context
=
current
->
audit_context
;
struct
audit_aux_data_fd_pair
*
ax
;
context
->
fds
[
0
]
=
fd1
;
context
->
fds
[
1
]
=
fd2
;
if
(
likely
(
!
context
))
{
return
0
;
}
ax
=
kmalloc
(
sizeof
(
*
ax
),
GFP_KERNEL
);
if
(
!
ax
)
{
return
-
ENOMEM
;
}
ax
->
fd
[
0
]
=
fd1
;
ax
->
fd
[
1
]
=
fd2
;
ax
->
d
.
type
=
AUDIT_FD_PAIR
;
ax
->
d
.
next
=
context
->
aux
;
context
->
aux
=
(
void
*
)
ax
;
return
0
;
}
}
/**
/**
...
...
net/socket.c
浏览文件 @
157cf649
...
@@ -1313,13 +1313,7 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
...
@@ -1313,13 +1313,7 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
goto
out_fd1
;
goto
out_fd1
;
}
}
err
=
audit_fd_pair
(
fd1
,
fd2
);
audit_fd_pair
(
fd1
,
fd2
);
if
(
err
<
0
)
{
fput
(
newfile1
);
fput
(
newfile2
);
goto
out_fd
;
}
fd_install
(
fd1
,
newfile1
);
fd_install
(
fd1
,
newfile1
);
fd_install
(
fd2
,
newfile2
);
fd_install
(
fd2
,
newfile2
);
/* fd1 and fd2 may be already another descriptors.
/* fd1 and fd2 may be already another descriptors.
...
@@ -1349,7 +1343,6 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
...
@@ -1349,7 +1343,6 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
out_fd1:
out_fd1:
put_filp
(
newfile2
);
put_filp
(
newfile2
);
sock_release
(
sock2
);
sock_release
(
sock2
);
out_fd:
put_unused_fd
(
fd1
);
put_unused_fd
(
fd1
);
put_unused_fd
(
fd2
);
put_unused_fd
(
fd2
);
goto
out
;
goto
out
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录