LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [GIT PULL] audit patches
@ 2007-02-18  4:01 Al Viro
  2007-02-22  0:03 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Al Viro @ 2007-02-18  4:01 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

Misc audit patches (resend again...); the most intrusive one is AUDIT_FD_PAIR,
allowing to log descriptor numbers from syscalls that do not return them in
usual way (i.e. pipe() and socketpair()).  It took some massage of
the failure exits in sys_socketpair(); the rest is absolutely trivial.
Please, pull from
git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git/ audit.b37

Al Viro (1):
      AUDIT_FD_PAIR

Steve Grubb (2):
      minor update to rule add/delete messages (ver 2)
      audit config lockdown

 fs/pipe.c             |    7 ++
 include/linux/audit.h |    9 ++
 kernel/audit.c        |  216 +++++++++++++++++++++++++++++++++++-------------
 kernel/auditfilter.c  |    9 +-
 kernel/auditsc.c      |   40 +++++++++
 net/socket.c          |   52 +++++++++---
 6 files changed, 257 insertions(+), 76 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GIT PULL] audit patches
  2007-02-18  4:01 [GIT PULL] audit patches Al Viro
@ 2007-02-22  0:03 ` Andrew Morton
  2007-02-22 13:22   ` Stephen Smalley
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2007-02-22  0:03 UTC (permalink / raw)
  To: Al Viro
  Cc: Linus Torvalds, linux-kernel, Steve Grubb, Stephen Smalley, James Morris

On Sun, 18 Feb 2007 04:01:27 +0000 Al Viro <viro@ftp.linux.org.uk> wrote:

> Misc audit patches (resend again...); the most intrusive one is AUDIT_FD_PAIR,
> allowing to log descriptor numbers from syscalls that do not return them in
> usual way (i.e. pipe() and socketpair()).  It took some massage of
> the failure exits in sys_socketpair(); the rest is absolutely trivial.
> Please, pull from
> git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git/ audit.b37

Please send patches to the list for review if practical?  In this case it
was.  I trust davem has had a look at the non-trivial changes to
sys_socketpair().



Looking at the changes to audit_receive_msg():


				if (sid) {
					if (selinux_sid_to_string(
							sid, &ctx, &len)) {
						audit_log_format(ab,
							" ssid=%u", sid);
						/* Maybe call audit_panic? */
					} else
						audit_log_format(ab,
							" subj=%s", ctx);
					kfree(ctx);
				}

This is assuming that selinux_sid_to_string() always initialises `ctx'.

But AFAICT there are two error paths in security_sid_to_context() which
forget to do that, so we end up doing kfree(uninitialised-local).

I'd consider that a shortcoming in security_sid_to_context(), so not a
problem in this patch, as long as people agree with my blaming above.


The coding style in there is a bit odd-looking.

The new __audit_fd_pair() has unneeded braces in it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GIT PULL] audit patches
  2007-02-22  0:03 ` Andrew Morton
@ 2007-02-22 13:22   ` Stephen Smalley
  2007-02-22 21:19     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Smalley @ 2007-02-22 13:22 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Al Viro, Linus Torvalds, linux-kernel, Steve Grubb, James Morris

On Wed, 2007-02-21 at 16:03 -0800, Andrew Morton wrote:
> On Sun, 18 Feb 2007 04:01:27 +0000 Al Viro <viro@ftp.linux.org.uk> wrote:
> 
> > Misc audit patches (resend again...); the most intrusive one is AUDIT_FD_PAIR,
> > allowing to log descriptor numbers from syscalls that do not return them in
> > usual way (i.e. pipe() and socketpair()).  It took some massage of
> > the failure exits in sys_socketpair(); the rest is absolutely trivial.
> > Please, pull from
> > git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git/ audit.b37
> 
> Please send patches to the list for review if practical?  In this case it
> was.  I trust davem has had a look at the non-trivial changes to
> sys_socketpair().
> 
> 
> 
> Looking at the changes to audit_receive_msg():
> 
> 
> 				if (sid) {
> 					if (selinux_sid_to_string(
> 							sid, &ctx, &len)) {
> 						audit_log_format(ab,
> 							" ssid=%u", sid);
> 						/* Maybe call audit_panic? */
> 					} else
> 						audit_log_format(ab,
> 							" subj=%s", ctx);
> 					kfree(ctx);
> 				}
> 
> This is assuming that selinux_sid_to_string() always initialises `ctx'.
> 
> But AFAICT there are two error paths in security_sid_to_context() which
> forget to do that, so we end up doing kfree(uninitialised-local).
> 
> I'd consider that a shortcoming in security_sid_to_context(), so not a
> problem in this patch, as long as people agree with my blaming above.

I wouldn't assume that the function initializes an argument if it
returns an error, and at least some of the callers (in auditsc.c) appear
to correctly initialize ctx to NULL themselves before calling
selinux_sid_to_string().  But if you'd prefer the function to always
handle it, we can do that.

> 
> The coding style in there is a bit odd-looking.
> 
> The new __audit_fd_pair() has unneeded braces in it.
-- 
Stephen Smalley
National Security Agency


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GIT PULL] audit patches
  2007-02-22 13:22   ` Stephen Smalley
@ 2007-02-22 21:19     ` Andrew Morton
  2007-02-23 14:00       ` [patch 1/1] selinux: always initialize arguments to security_sid_to_context (Was: Re: [GIT PULL] audit patches) Stephen Smalley
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2007-02-22 21:19 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: viro, torvalds, linux-kernel, sgrubb, jmorris

> On Thu, 22 Feb 2007 08:22:47 -0500 Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On Wed, 2007-02-21 at 16:03 -0800, Andrew Morton wrote:
> > 
> > Looking at the changes to audit_receive_msg():
> > 
> > 
> > 				if (sid) {
> > 					if (selinux_sid_to_string(
> > 							sid, &ctx, &len)) {
> > 						audit_log_format(ab,
> > 							" ssid=%u", sid);
> > 						/* Maybe call audit_panic? */
> > 					} else
> > 						audit_log_format(ab,
> > 							" subj=%s", ctx);
> > 					kfree(ctx);
> > 				}
> > 
> > This is assuming that selinux_sid_to_string() always initialises `ctx'.
> > 
> > But AFAICT there are two error paths in security_sid_to_context() which
> > forget to do that, so we end up doing kfree(uninitialised-local).
> > 
> > I'd consider that a shortcoming in security_sid_to_context(), so not a
> > problem in this patch, as long as people agree with my blaming above.
> 
> I wouldn't assume that the function initializes an argument if it
> returns an error, and at least some of the callers (in auditsc.c) appear
> to correctly initialize ctx to NULL themselves before calling
> selinux_sid_to_string().  But if you'd prefer the function to always
> handle it, we can do that.
> 

Well we now have (at least) one caller which assumes that *ctx is
initialied in error cases.

And I think it's sane to make it do that: safer, and will simplify coding
in the callers.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 1/1] selinux:  always initialize arguments to security_sid_to_context (Was: Re: [GIT PULL] audit patches)
  2007-02-22 21:19     ` Andrew Morton
@ 2007-02-23 14:00       ` Stephen Smalley
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Smalley @ 2007-02-23 14:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: viro, torvalds, linux-kernel, sgrubb, jmorris

On Thu, 2007-02-22 at 13:19 -0800, Andrew Morton wrote:
> > On Thu, 22 Feb 2007 08:22:47 -0500 Stephen Smalley <sds@tycho.nsa.gov> wrote:
> > On Wed, 2007-02-21 at 16:03 -0800, Andrew Morton wrote:
> > > 
> > > Looking at the changes to audit_receive_msg():
> > > 
> > > 
> > > 				if (sid) {
> > > 					if (selinux_sid_to_string(
> > > 							sid, &ctx, &len)) {
> > > 						audit_log_format(ab,
> > > 							" ssid=%u", sid);
> > > 						/* Maybe call audit_panic? */
> > > 					} else
> > > 						audit_log_format(ab,
> > > 							" subj=%s", ctx);
> > > 					kfree(ctx);
> > > 				}
> > > 
> > > This is assuming that selinux_sid_to_string() always initialises `ctx'.
> > > 
> > > But AFAICT there are two error paths in security_sid_to_context() which
> > > forget to do that, so we end up doing kfree(uninitialised-local).
> > > 
> > > I'd consider that a shortcoming in security_sid_to_context(), so not a
> > > problem in this patch, as long as people agree with my blaming above.
> > 
> > I wouldn't assume that the function initializes an argument if it
> > returns an error, and at least some of the callers (in auditsc.c) appear
> > to correctly initialize ctx to NULL themselves before calling
> > selinux_sid_to_string().  But if you'd prefer the function to always
> > handle it, we can do that.
> > 
> 
> Well we now have (at least) one caller which assumes that *ctx is
> initialied in error cases.
> 
> And I think it's sane to make it do that: safer, and will simplify coding
> in the callers.

Ok, patch below.

Always initialize *scontext and *scontext_len in security_sid_to_context.

Signed-off-by:  Stephen Smalley <sds@tycho.nsa.gov>

---

 security/selinux/ss/services.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index ca9154d..1e52356 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -609,6 +609,9 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
 	struct context *context;
 	int rc = 0;
 
+	*scontext = NULL;
+	*scontext_len  = 0;
+
 	if (!ss_initialized) {
 		if (sid <= SECINITSID_NUM) {
 			char *scontextp;

-- 
Stephen Smalley
National Security Agency


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [git pull] audit patches
@ 2009-04-05 19:17 Al Viro
  0 siblings, 0 replies; 7+ messages in thread
From: Al Viro @ 2009-04-05 19:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

Please, pull from
git//git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git/ audit.b62

Shortlog:
Eric Paris (2):
      audit: incorrect ref counting in audit tree tag_chunk
      audit: audit_set_auditable defined but not used

Jiri Pirko (1):
      audit: EXECVE record - removed bogus newline

Miloslav Trmac (2):
      Audit: fix handling of 'strings' with NULL characters
      audit: ignore terminating NUL in AUDIT_USER_TTY messages

Paul Moore (1):
      audit: Fix possible return value truncation in audit_get_context()

Randy Dunlap (1):
      auditsc: fix kernel-doc notation

Zhenwen Xu (1):
      make the e->rule.xxx shorter in kernel auditfilter.c

Diffstat:
 kernel/audit.c       |    5 ++++-
 kernel/audit_tree.c  |    2 ++
 kernel/auditfilter.c |   16 ++++++++--------
 kernel/auditsc.c     |   31 +++++++++++++++----------------
 4 files changed, 29 insertions(+), 25 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [git pull] audit patches
@ 2008-04-29 18:08 Al Viro
  0 siblings, 0 replies; 7+ messages in thread
From: Al Viro @ 2008-04-29 18:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

Assorted audit patches for this cycle.  Please, pull from
git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git/ audit.b50

Shortlog:
Al Viro (1):
      new predicate - AUDIT_FILETYPE

Eric Paris (7):
      Audit: end printk with newline
      Audit: collect sessionid in netlink messages
      Audit: save audit_backlog_limit audit messages in case auditd comes back
      Audit: stop deadlock from signals under load
      Audit: standardize string audit interfaces
      Audit: increase the maximum length of the key field
      Audit: MAINTAINERS update

Harvey Harrison (2):
      audit: move extern declarations to audit.h
      audit: fix sparse shadowed variable warnings

Miloslav Trmac (1):
      [patch 1/2] audit: let userspace fully control TTY input auditing

Pavel Emelyanov (1):
      [patch 2/2] Use find_task_by_vpid in audit code

Diffstat:
 MAINTAINERS                       |    8 +-
 drivers/char/tty_audit.c          |   63 +---------
 drivers/char/tty_io.c             |    5 +-
 include/linux/audit.h             |   28 +++--
 include/linux/netlink.h           |    1 +
 include/linux/tty.h               |    9 +-
 include/net/netlabel.h            |    1 +
 include/net/xfrm.h                |   23 ++--
 kernel/audit.c                    |  249 +++++++++++++++++++++++++-----------
 kernel/audit.h                    |   13 ++
 kernel/auditfilter.c              |   45 ++++---
 kernel/auditsc.c                  |   40 ++++---
 net/key/af_key.c                  |   17 ++-
 net/netlabel/netlabel_unlabeled.c |    1 +
 net/netlabel/netlabel_user.c      |    4 +-
 net/netlabel/netlabel_user.h      |    1 +
 net/netlink/af_netlink.c          |    1 +
 net/xfrm/xfrm_policy.c            |   12 ++-
 net/xfrm/xfrm_state.c             |   13 ++-
 net/xfrm/xfrm_user.c              |   41 ++++--
 security/selinux/avc.c            |    2 +-
 security/smack/smackfs.c          |    2 +
 22 files changed, 346 insertions(+), 233 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-05 19:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-18  4:01 [GIT PULL] audit patches Al Viro
2007-02-22  0:03 ` Andrew Morton
2007-02-22 13:22   ` Stephen Smalley
2007-02-22 21:19     ` Andrew Morton
2007-02-23 14:00       ` [patch 1/1] selinux: always initialize arguments to security_sid_to_context (Was: Re: [GIT PULL] audit patches) Stephen Smalley
2008-04-29 18:08 [git pull] audit patches Al Viro
2009-04-05 19:17 Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).