mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] seq_file version of /proc/interrupts
Date: Thu, 13 Nov 2003 19:35:12 +0000	[thread overview]
Message-ID: <20031113193512.GH24159@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20031113173626.12557.qmail@lwn.net>

On Thu, Nov 13, 2003 at 10:36:26AM -0700, Jonathan Corbet wrote:
> While I was messing with the seq_file document, I went ahead and hacked up
> an implementation of /proc/interrupts.  This will be a first pass; if
> nothing else, it breaks every architecture except i386.  Fixing the others
> should not be hard, though I can't test them.  I've also misplaced my
> 100-CPU system somewhere, so I can't verify that it solves the initial
> problem.  But it should.
> 
> This version should scale to something over 300 processors, after which it
> will not be possible to fit even a single line of /proc/interrupts output
> into one page.  At that point, if this output format is even remotely
> useful, some sort of iterator which tracks interrupt and CPU numbers will
> be needed.

What the hell?  You *do* realize that seq_read() will increase the buffer
size if it can't fit the single entry into the current buffer, don't you?

Guys, there is no 4Kb limit.  At all.  You get longer entries - fine, the
thing will work.  It will grow buffer large enough to hold the longest
entry, though.

You don't *have* to preallocate buffer - it makes sense to do if you know
that one page will be too tight anyway, but it's not required.

You obviously want to keep entries reasonably small - exactly because users
can open the file and start reading from it.  Which will allocate (besides
the things normally allocated for any opened file) a buffer for said entries.

As long as it stays within several pages, there's no problem - after all,
you can always open a pipe and write to it / open a pair of AF_UNIX sockets
and send yourself datagrams / etc.  It's not that situation was unusual.
If you get buffer much bigger than that, you are asking for a DoS, obviously.

  parent reply	other threads:[~2003-11-13 19:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-13 17:36 Jonathan Corbet
2003-11-13 18:02 ` Jesse Barnes
2003-11-13 19:35 ` viro [this message]
2003-11-13 21:39   ` Jonathan Corbet
2003-11-13 22:26     ` Erik Jacobson
2003-11-20 16:58       ` Erik Jacobson
2003-12-23  0:22     ` Anton Blanchard
2003-12-23  0:38       ` Jonathan Corbet
2003-12-23  0:49         ` Andrew Morton
2003-12-23  1:18           ` Mike Fedyk

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=20031113193512.GH24159@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®