dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Gris Ge <fge@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: dm-devel@redhat.com
Subject: Re: [PATCH V3 1/3] multipath-tools: Increase MAX_REPLY_LEN.
Date: Mon, 4 Jul 2016 17:11:46 +0800	[thread overview]
Message-ID: <20160704091146.GA3081@redhat.com> (raw)
In-Reply-To: <5779FC9F.6010209@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 2377 bytes --]

On Mon, Jul 04, 2016 at 08:05:19AM +0200, Hannes Reinecke wrote:
> On 07/02/2016 02:25 AM, Gris Ge wrote:
> > On Fri, Jul 01, 2016 at 04:46:53PM +0200, Hannes Reinecke wrote:
> >>> -#define MAX_REPLY_LEN		65536
> >>> +#define MAX_REPLY_LEN		10485760
> >>> +/* ^ 10 MiB, enough for 'show maps json' command with 10k paths which
> >>> + *   requires about 8 MiB */
> >>>  
> >>>  
> >> Huh.
> >> Can't say I like it. The limit is pretty much self-imposed, so I'd
> >> rather bite the bullet and make it size-independent.
> >>
> >> Cheers,
> >>
> >> Hannes
> >> -- 
> >> Dr. Hannes Reinecke		   Teamlead Storage & Networking
> > 
> > Hi Hannes Reinecke,
> > 
> > How about limit the input command string size and let multipathd
> > output size-independent?
> > 
> Hmm?
> We already know the size of the input (we're getting it from the
> commandline, after all). So there's no need to arbitrary limit
Not exactly, malicious IPC client application using their own socket
client implementation could send something like:
    999999999999999fake command
which will lead multipathd daemon to allocate a big chunk of memory.

Even with legal IPC client library libmpathcmd, IPC client could send
a really string to daemon.

I reworked this patch to prevent this.

Meanwhile since we don't have IPC socket user ID check, above
malicious command does not require root privilege(will fix in next
week).
> anything here; we know exactly how much memory we need to allocate.
> It's just for the _output_ where we need to be careful, as we need
> to ensure that we don't allocate insane amount of memory in the
> daemon nor in the client.
On the contrary, if multipathd daemon output a insane mount of memory,
it should be a bug of multipathd daemon, rather than libmpathcmd.

Data from multipathd to IPC client[1] should be trusted and unlimited,
while data from IPC client to multipathd should be limited to
small size(let's say 255 is enough).
> So for the output we should look at implementing some sort of
> chunked response; maybe having a 4k transmit buffer, and adding a
> status bit in the CLI response instructing the client to keep on
> reading.  Or something like that.

> 
> Cheers,
> 
> Hannes
> -- 
> Dr. Hannes Reinecke		   Teamlead Storage & Networking

[1]: 'multipathd -k' is IPC client also.

-- 
Gris Ge

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2016-07-04  9:11 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  3:52 [PATCH] Introducing multipath C API <libdmmp/libdmmp.h> Gris Ge
2016-01-28  9:15 ` Hannes Reinecke
2016-01-28  9:40   ` Gris Ge
2016-02-01 13:13   ` Todd Gill
2016-02-01 13:36     ` Hannes Reinecke
2016-02-12  8:10       ` [PATCH V2] Introducing multipath C API Gris Ge
2016-02-12  8:10         ` [PATCH V2] Introducing multipath C API <libdmmp/libdmmp.h> Gris Ge
2016-03-04 16:06           ` Benjamin Marzinski
2016-03-05  9:46             ` Gris Ge
2016-07-01 12:46           ` [PATCH V3 0/3] Introducing multipath C API Gris Ge
2016-07-01 12:46             ` [PATCH V3 1/3] multipath-tools: Increase MAX_REPLY_LEN Gris Ge
2016-07-01 14:46               ` Hannes Reinecke
2016-07-02  0:25                 ` Gris Ge
2016-07-04  6:05                   ` Hannes Reinecke
2016-07-04  9:11                     ` Gris Ge [this message]
2016-07-04  9:17                       ` [PATCH V4 0/3] Introducing multipath C API Gris Ge
2016-07-04  9:17                         ` [PATCH V4 1/3] multipath-tools: New way to limit the IPC command length Gris Ge
2016-07-04  9:17                         ` [PATCH V4 2/3] multipath-tools: Set errno mpath_recv_reply() when failure Gris Ge
2016-07-04  9:17                         ` [PATCH V4 3/3] multipath-tools: Introducing multipath C API Gris Ge
2016-07-04  9:27                         ` [PATCH V4 0/3] " Gris Ge
2016-07-04  9:29                         ` Please ignore this patch set. ([PATCH V4 0/3] Introducing multipath C API) Gris Ge
2016-07-04  9:40                         ` [PATCH V5 0/3] Introducing multipath C API Gris Ge
2016-07-04  9:40                           ` [PATCH V5 1/3] multipath-tools: New way to limit the IPC command length Gris Ge
2016-07-04  9:40                           ` [PATCH V5 2/3] multipath-tools: Set errno mpath_recv_reply() when failure Gris Ge
2016-07-04  9:40                           ` [PATCH V5 3/3] multipath-tools: Introducing multipath C API Gris Ge
2016-07-01 12:46             ` [PATCH V3 2/3] multipath-tools: Set errno mpath_recv_reply() when failure Gris Ge
2016-07-01 12:46             ` [PATCH V3 3/3] multipath-tools: Introducing multipath C API <libdmmp/libdmmp.h> Gris Ge
2016-07-01 12:55             ` [PATCH " Gris Ge
2016-07-01 13:06             ` [PATCH V3 " Gris Ge
2016-07-12  6:50 ` [PATCH V6 0/3] Introducing multipath C API Gris Ge
2016-07-12  6:50   ` [PATCH V6 1/3] multipath-tools: New way to limit the IPC command length Gris Ge
2016-07-15 21:35     ` Benjamin Marzinski
2016-07-18 12:38       ` Gris Ge
2016-08-12 15:57       ` Bart Van Assche
2016-08-12 21:35         ` Benjamin Marzinski
2016-08-12 21:49           ` Bart Van Assche
2016-07-12  6:50   ` [PATCH V6 2/3] multipath-tools: Set errno mpath_recv_reply() when failure Gris Ge
2016-07-12  6:50   ` [PATCH V6 3/3] multipath-tools: Introducing multipath C API Gris Ge
2016-07-15 21:36   ` [PATCH V6 0/3] " Benjamin Marzinski
2016-08-12 12:12 ` [PATCH V7 0/4] multipath: " Gris Ge
2016-08-12 12:12   ` [PATCH V7 1/4] libmpathcmd: Block SIGPIPE when write() Gris Ge
2016-08-12 16:01     ` Bart Van Assche
2016-08-12 12:12   ` [PATCH V7 2/4] multipath-tools: New way to limit the IPC command length Gris Ge
2016-08-12 15:48     ` Bart Van Assche
2016-08-12 21:53     ` Benjamin Marzinski
2016-08-12 12:12   ` [PATCH V7 3/4] multipath-tools: Set errno mpath_recv_reply() when failure Gris Ge
2016-08-12 12:12   ` [PATCH V7 4/4] multipath-tools: Introducing multipath C API Gris Ge
2017-02-24 12:50     ` [PATCH V5] " Gris Ge
2017-02-27  5:56       ` Christophe Varoqui
2017-02-24 13:07     ` Gris Ge
2016-08-12 13:26   ` [PATCH V7 0/4] multipath: " Gris Ge

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=20160704091146.GA3081@redhat.com \
    --to=fge@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).