[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140501225116.GB25669@mail.hallyn.com>
Date: Fri, 2 May 2014 00:51:16 +0200
From: "Serge E. Hallyn" <serge@...lyn.com>
To: Richard Guy Briggs <rgb@...hat.com>
Cc: linux-audit@...hat.com, linux-kernel@...r.kernel.org,
containers@...ts.linux-foundation.org, serge.hallyn@...ntu.com,
eparis@...hat.com, sgrubb@...hat.com, ebiederm@...ssion.com
Subject: Re: [PATCH 1/2] namespaces: give each namespace a serial number
Quoting Richard Guy Briggs (rgb@...hat.com):
Most of this looks reasonable, but I'm curious about something,
> +/**
> + * ns_serial - compute a serial number for the namespace
> + *
> + * Compute a serial number for the namespace to uniquely identify it in
> + * audit records.
> + */
> +unsigned int ns_serial(void)
> +{
> + static DEFINE_SPINLOCK(serial_lock);
> + static unsigned int serial = 4; /* reserved for IPC, UTS, user, PID */
> +
> + unsigned long flags;
> + unsigned int ret;
> +
> + spin_lock_irqsave(&serial_lock, flags);
> + do {
> + ret = ++serial;
> + } while (unlikely(!ret));
Why exactly are you doing this? Surely if serial is going to
wrap around we've got a bigger problem than just wanting go
bump one more time?
> + spin_unlock_irqrestore(&serial_lock, flags);
> +
> + return ret;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists