[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <25ae38200706050720x6d691629na7657856513a2b97@mail.gmail.com>
Date: Tue, 5 Jun 2007 07:20:06 -0700
From: "Anand Jahagirdar" <anandjigar@...il.com>
To: "Daniel Hazelton" <dhazelton@...er.net>
Cc: "Jiri Kosina" <jikos@...os.cz>, Nix <nix@...eri.org.uk>,
"Jens Axboe" <jens.axboe@...cle.com>, security@...nel.org,
linux-kernel@...r.kernel.org,
"Kedar Sovani" <kedar@...amzgroup.com>
Subject: Re: Patch related with Fork Bombing Atack
Hello All
I am forwarding one more improved patch related with fork
bombing attack. I have used printk_ratelimit function in my patch
and it works rellly well. it prints message as per printk_ratelimit
values stored in /proc/sys/kernel/printk_ratelimit
and /proc/sys/kernel/printk_ratelimit_burst.
root can set printk_ratelimit values(such as how many times message
should be repeated ,after how much time message should repeat) by
making changes in the above 2 mentioned files.
this patch will never flood syslog anymore and will definitely
help administrator by informing him about fork bombing attack.
added comments will help developers.
Regards,
Anand
On 6/4/07, Daniel Hazelton <dhazelton@...er.net> wrote:
> On Monday 04 June 2007 10:58:41 Jiri Kosina wrote:
> > On Mon, 4 Jun 2007, Anand Jahagirdar wrote:
> > > I am forwarding one improved patch related with Fork Bombing
> > > Attack. This patch prints a message (only once) which alerts
> > > administrator/root user about fork bombing attack. I created this patch
> > > to implement my idea of informing administrator about fork bombing
> > > attack on his machine only once.
> > > This patch overcomes all drawbacks of my previous patch related with
> > > fork bombing attack and helps administrator. added comments will
> > > definitely help developers.
> > >
> > > + /*
> > > + * following code prints a message which alerts administrator/root *
> > > user about fork bombing Attack + */
> > > + if ((atomic_read(&p->user->processes) >=
> > > (p->signal->rlim [RLIMIT_NPROC].rlim_cur - 1)) &&
> > > (atomic_read(&p->user->processes) <
> > > p->signal->rlim[RLIMIT_NPROC].rlim_cur)) {
> >
> > Did this get malformed somehow? Looks like some successive lines got
> > pasted together, or something.
>
> Seeing the lack of the '+' I think it's a mangling from not paying attention
> to the 80 column marker in the editor.
>
> > > + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
> > > p->user != &root_user) { + printk(KERN_CRIT"User with uid %d is
> > > crossing its Process limit\n",p->user->uid); + }
> > > + }
> >
> > Why not printk_ratelimit() here? Otherwise we have looped back to the
> > possibility of user flooding the system logs, which has been already
> > discussed in this thread, right?
> >
> > Also the { and } braces seem redundant.
> They are.
>
> Here's two hints:
> 1) double check for hidden "word wrap" problems. A sane programmers editor
> will alert you to this, and careful checking of the patches before posting
> will also reveal them. (emacs shows a \ in the 80th column, jed puts a $
> there, etc...)
> 2) when there is a potential for syslog spam - like your patch has - use
> printk_ratelimit() instead of printk(). This will throttle the output so that
> flooding the syslog is no longer possible.
>
> DRH
> ps: you patch is very difficult to apply - try using git
>
View attachment "fork.patch" of type "text/plain" (1032 bytes)
Powered by blists - more mailing lists