All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH v2 6/8] Stop buffer overflow
Date: Thu, 16 Oct 2014 00:19:41 +0900	[thread overview]
Message-ID: <20141015151941.GL1189@swordfish> (raw)
In-Reply-To: 543E8C47.1050504@linux.intel.com

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

On (10/15/14 08:01), Arjan van de Ven wrote:
> >>>yes, this is the reason behind this proposal. these patches a) don't check for
> >>>overrun; b) don't handle overrun. they just shut up the compiler.
> >>
> >>
> >>that's never a good tradeoff.
> >>-D_FORTIFY_SOURCE-2 is an essential compiler feature that has a defined semantic/etc
> >>patches that make behavior worse than that baseline, but shut up some warning, are damage
> >>not value.
> >>
> >
> >well, the macro handles overrun (should probably be snprintf(a, bsz - 1, ...) >= bsz)
> >and replaces small part of the buffer with '...\0'. which is, imho, a bit better
> >than `backtrace(); abort();' (I don't think we can benefit from compile-time checks
> >of -D_FORTIFY_SOURCE=2, only run time ones) for developers that behaviour makes
> >sense, for users it's just "seg fault/core dump/whatever"
> 
> well it's that or corruption....

well '...' is just for example. we usually don't see processes
with '...' or devices with '...' in their names. could be any
error indication. e.g. 'ERROR', 'E2BIG', etc.

> the data is still truncated and partial.. and you keep running with it.

which is not that big deal. I agree, that this is not 100% handy.
but suppose there is a process with very long name. long enough to cause
overrun and powertop abort(). and that process is part of a runtime and
it must be alive, etc... and that automatically leaves only one option --
either that process or powertop. and never together.

	-ss

> (this is why many people first think strlcpy is a good idea, and then they think more about it and realize it's not)
> 
> 

             reply	other threads:[~2014-10-15 15:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15 15:19 Sergey Senozhatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-10-15 15:55 [Powertop] [PATCH v2 6/8] Stop buffer overflow Joe Konno
2014-10-15 15:42 Sergey Senozhatsky
2014-10-15 15:24 Arjan van de Ven
2014-10-15 15:01 Sergey Senozhatsky
2014-10-15 15:01 Arjan van de Ven
2014-10-15 14:46 Sergey Senozhatsky
2014-10-15 14:34 Arjan van de Ven
2014-10-15 14:21 Sergey Senozhatsky
2014-10-15 14:05 Arjan van de Ven
2014-10-15 14:03 Sergey Senozhatsky
2014-10-15 13:55 Sergey Senozhatsky
2014-10-15 12:54 Sergey Senozhatsky
2014-10-14 18:09 Joe Konno

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=20141015151941.GL1189@swordfish \
    --to=powertop@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.