* [PATCH] In some platforms, "connect", "bind", "accept", "sendto", "recvfrom", "sendfile" arenot audit directly.
@ 2008-07-30 8:29 zhangxiliang
2008-07-30 11:58 ` Steve Grubb
0 siblings, 1 reply; 2+ messages in thread
From: zhangxiliang @ 2008-07-30 8:29 UTC (permalink / raw)
To: sgrubb, Linux Audit
Hello Steve,
When I use "autrace -r" or "auditctl -a exit,always -S connect" on "ia32" machine, it report some error.
I found in some platforms, "connect", "bind", "accept", "sendto", "recvfrom", "sendfile" isnot supported to call directly.
They are used by syscall "socketcall".
I think when the socket calls are supported, we should insert "socketcall" instead of them.
Do you agree with me?
Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
lib/deprecated.c | 7 +++++++
lib/libaudit.c | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/lib/deprecated.c b/lib/deprecated.c
index 4f0c14e..ced4c62 100644
--- a/lib/deprecated.c
+++ b/lib/deprecated.c
@@ -160,6 +160,13 @@ int audit_rule_syscallbyname(struct audit_rule *rule,
if (nr < 0) {
if (isdigit(scall[0]))
nr = strtol(scall, NULL, 0);
+ if(strcmp(scall, "connect") || strcmp(scall, "bind")
+ || strcmp(scall, "accept") || strcmp(scall, "sendto")
+ || strcmp(scall, "recvfrom") || strcmp(scall, "sendfile")) {
+ scall = "socketcall";
+ nr = audit_name_to_syscall(scall, machine);
+ }
+
}
if (nr >= 0)
return audit_rule_syscall(rule, nr);
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 0588537..36baff1 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -761,6 +761,12 @@ int audit_rule_syscallbyname_data(struct audit_rule_data *rule,
if (nr < 0) {
if (isdigit(scall[0]))
nr = strtol(scall, NULL, 0);
+ if(strcmp(scall, "connect") || strcmp(scall, "bind")
+ || strcmp(scall, "accept") || strcmp(scall, "sendto")
+ || strcmp(scall, "recvfrom") || strcmp(scall, "sendfile")) {
+ scall = "socketcall";
+ nr = audit_name_to_syscall(scall, machine);
+ }
}
if (nr >= 0)
return audit_rule_syscall_data(rule, nr);
--
1.5.4.2
--
Regards
Zhang Xiliang
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] In some platforms, "connect", "bind", "accept", "sendto", "recvfrom", "sendfile" arenot audit directly.
2008-07-30 8:29 [PATCH] In some platforms, "connect", "bind", "accept", "sendto", "recvfrom", "sendfile" arenot audit directly zhangxiliang
@ 2008-07-30 11:58 ` Steve Grubb
0 siblings, 0 replies; 2+ messages in thread
From: Steve Grubb @ 2008-07-30 11:58 UTC (permalink / raw)
To: zhangxiliang; +Cc: Linux Audit
On Wednesday 30 July 2008 04:29:55 zhangxiliang wrote:
> When I use "autrace -r" or "auditctl -a exit,always -S connect" on "ia32"
> machine, it report some error. I found in some platforms, "connect",
> "bind", "accept", "sendto", "recvfrom", "sendfile" is not supported to call
> directly. They are used by syscall "socketcall".
>
> I think when the socket calls are supported, we should insert "socketcall"
> instead of them. Do you agree with me?
Yes, I do. I have that listed in the TODO file at line 45. Getting this
working would be a big help. However, there is one piece missing. Its not
sufficient to just switch over to socketcall, you also have to tell it via
the a0 field which socketcall represents the correct one. There are about 15
syscalls that are multiplexed through socketcall with each one being a
different a0 parameter.
For example, maybe we want to audit the connect syscall. If we look
at /usr/include/linux/net.h, you find
#define SYS_CONNECT 3 /* sys_connect(2) */
Therefore the audit rule would be:
auditctl -a always,exit -S socketcall -F a0=3
So, we would need the patch to set the a0 field. That lookup table probably
belongs in lib/lookup_table.c. There is a number to text converter in
src/ausearch-lookup.c which might need to be moved. on the other hand, it
might be simpler to just call the socketcall_lookup in src/ausearch-lookup.c
and iterate through it by number until the text matches. That is not terribly
efficient, but auditctl is not used very often and is not required to be
fast. Either way is fine with me.
Also, we have the same problem that you identified with ipccall. Its defined
numbers are in /usr/include/linux/ipc.h.
Thanks,
-Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-30 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-30 8:29 [PATCH] In some platforms, "connect", "bind", "accept", "sendto", "recvfrom", "sendfile" arenot audit directly zhangxiliang
2008-07-30 11:58 ` Steve Grubb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox