Re: [PATCH 1/2] namespaces: give each namespace a serial number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Richard Guy Briggs (rgb@xxxxxxxxxx):

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;
> +}
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/containers




[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux