public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: Re: fopen mode for buffer clearing
Date: Thu, 13 Apr 2017 17:28:00 -0000	[thread overview]
Message-ID: <7739ed33-3dba-affa-b523-57874b65f9db@linaro.org> (raw)
In-Reply-To: <d2c4eb40-7619-424b-7c2d-2b9e6be1a292@redhat.com>

On 13/04/2017 06:41, Florian Weimer wrote:
> We used to use mmap for the internal FILE * buffer.  This had the side effect that after fclose, the data in the buffer may not be gone from the system as a whole, but it will definitely not be part of the address space of the process anymore.  This is desirable if the stdio stream functions are used to process sensitive data because it reduces the risk of leaks.
> 
> Would it make sense to add an fopen mode flag to indicate that the implementation should clear the buffer (with explicit_bzero) before deallocating it?  This would also apply to reallocating buffers in getline.
> 
> Thanks,
> Florian

I really dislike exposing implementation details in an API sense, it adds
compatibility issues for other libcs and in the case we want to change the 
internal implementation (since we not have an additional constraint).

Also, for security sensitive operation it would make sense to define an
specific buffer with setvbuf and then the application can control how to
deallocate the buffer.

      reply	other threads:[~2017-04-13 17:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  9:41 Florian Weimer
2017-04-13 17:28 ` Adhemerval Zanella [this message]

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=7739ed33-3dba-affa-b523-57874b65f9db@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).