Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8883
b: refs/heads/master
c: d5b454f
h: refs/heads/master
i:
  8881: 2371efb
  8879: 3c34457
v: v3
  • Loading branch information
David Woodhouse committed Jul 15, 2005
1 parent 128b1e2 commit 6e96453
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 351bb722590b2329ac5e72c4b824b8b6ce6e3082
refs/heads/master: d5b454f2c40c9efd0cc113bc3220ebcb66b7c022
21 changes: 10 additions & 11 deletions trunk/kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,26 +610,25 @@ static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx,
* (timestamp,serial) tuple is unique for each syscall and is live from
* syscall entry to syscall exit.
*
* Atomic values are only guaranteed to be 24-bit, so we count down.
*
* NOTE: Another possibility is to store the formatted records off the
* audit context (for those records that have a context), and emit them
* all at syscall exit. However, this could delay the reporting of
* significant errors until syscall exit (or never, if the system
* halts). */

unsigned int audit_serial(void)
{
static atomic_t serial = ATOMIC_INIT(0xffffff);
unsigned int a, b;
static spinlock_t serial_lock = SPIN_LOCK_UNLOCKED;
static unsigned int serial = 0;

unsigned long flags;
unsigned int ret;

do {
a = atomic_read(&serial);
if (atomic_dec_and_test(&serial))
atomic_set(&serial, 0xffffff);
b = atomic_read(&serial);
} while (b != a - 1);
spin_lock_irqsave(&serial_lock, flags);
ret = serial++;
spin_unlock_irqrestore(&serial_lock, flags);

return 0xffffff - b;
return ret;
}

static inline void audit_get_stamp(struct audit_context *ctx,
Expand Down

0 comments on commit 6e96453

Please sign in to comment.