[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.02.1109021120450.2723@ionos>
Date: Fri, 2 Sep 2011 11:30:47 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Andi Kleen <andi@...stfloor.org>
cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
eric.dumazet@...il.com, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 2/4] posix-timers: limit the number of posix timers per
process
On Mon, 29 Aug 2011, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> Now this is the main reason I wrote the whole patchkit: previously
> there was no limit on the maximum number of POSIX timers a process
> could allocate. This limits the amount of unswappable kernel memory
> a process can pin down this way.
>
> With the POSIX timer ids being per process we can do this limit
> per process now without allowing one process DoSing another.
>
> I implemented it as a sysctl, not a rlimit for now, because
> there was no clear use case for rlimit.
rlimit please.
> /*
> * we assume that the new SIGEV_THREAD_ID shares no bits with the other
> * SIGEV values. Here we put out an error if this assumption fails.
> @@ -572,6 +574,12 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
>
> it_id_set = IT_ID_SET;
> new_timer->it_id = (timer_t) new_timer_id;
> +
> + if (new_timer_id >= sysctl_max_posix_timers) {
> + error = -EMFILE; /* better error? */
EPERM might work as well
Thanks,
tglx
--
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