public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Hazelton <dhazelton@enter.net>
To: Jiri Kosina <jikos@jikos.cz>
Cc: Anand Jahagirdar <anandjigar@gmail.com>, Nix <nix@esperi.org.uk>,
	Jens Axboe <jens.axboe@oracle.com>,
	security@kernel.org, linux-kernel@vger.kernel.org,
	Kedar Sovani <kedar@dreamzgroup.com>
Subject: Re: Patch related with Fork Bombing Atack
Date: Mon, 4 Jun 2007 11:28:35 -0400	[thread overview]
Message-ID: <200706041128.35321.dhazelton@enter.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0706041652130.24237@twin.jikos.cz>

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

  reply	other threads:[~2007-06-04 15:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 13:45 Patch related with Fork Bombing Atack Anand Jahagirdar
2007-05-31 13:46 ` Jens Axboe
2007-06-01  6:48   ` Anand Jahagirdar
2007-06-01  7:25     ` Daniel Hazelton
2007-06-01  7:30       ` Jens Axboe
2007-06-01  8:00         ` Daniel Hazelton
2007-06-01  8:02           ` Jens Axboe
2007-06-03 23:01         ` Nix
2007-06-04  1:29           ` Daniel Hazelton
2007-06-04 14:49             ` Anand Jahagirdar
2007-06-04 14:58               ` Jiri Kosina
2007-06-04 15:28                 ` Daniel Hazelton [this message]
2007-06-05 14:20                   ` Anand Jahagirdar
2007-06-01  8:38     ` Jiri Kosina
2007-06-01 14:29       ` Anand Jahagirdar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706041128.35321.dhazelton@enter.net \
    --to=dhazelton@enter.net \
    --cc=anandjigar@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jikos@jikos.cz \
    --cc=kedar@dreamzgroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nix@esperi.org.uk \
    --cc=security@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox