linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Elsayed <eternaleye@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] WIP: Add syscall unlinkat_s (currently x86* only)
Date: Tue, 03 Feb 2015 08:44:03 -0800	[thread overview]
Message-ID: <maqtsj$bko$2@ger.gmane.org> (raw)
In-Reply-To: 54D093A0.7090201@ahsoftware.de

Alexander Holler wrote:

> Am 03.02.2015 um 09:51 schrieb Alexander Holler:
>> Am 03.02.2015 um 08:56 schrieb Al Viro:
>>> On Tue, Feb 03, 2015 at 07:58:50AM +0100, Alexander Holler wrote:
>>>
>>>>> Charming.  Now, what exactly happens if two such syscalls overlap in
>>>>> time?
>>>>
>>>> What do you think will happen? I assume you haven't looked at how I've
>>>> implemented set_secure_delete(). CHarming.
>>>
>>> AFAICS, you get random unlink() happening at the same time hit by that
>>> mess, whether they'd asked for it or not.  What's more, this counter
>>> of yours is *not* guaranteed to be elevated during the final iput() of
>>> the
>>> inode you wanted to get - again, ls -lR racing with that syscall can
>>> elevate the refcount of dentry, making d_delete() in vfs_unlink() just
>>> remove that dentry from hash, while keeping it positive.  If dentry
>>> reference grabbed by stat(2) is released after both dput() and iput() in
>>> do_unlinkat(), the final iput() will be done when stat(2) drops its
>>> reference to dentry, triggering immediate dentry_kill() (since dentry
>>> has already been unhashed) and dentry_iput() from it.
>>
>> Thanks for the short explanation. I will see if I can make sense out of
>> it for me to get an idea how to solve that.
>>
>>>
>>> IOW, this counter is both too crude (it's fs-wide, for crying out loud)
>>> *and* not guaranteed to cover enough.  _IF_ you want that behaviour at
>>
>> Sure it is crude.
>>
>> But it keeps the patches simple. As I've written, unlinkat_s() isn't
>> meant for everyday usage, just for the rare case when one really wants
>> to get rid of some contents. Therefor execution speed or an i/o slowdown
>> while the "secure deletion" is in work is totally ignored
>>
>> And that "rare case" doesn't include military security levels, it's just
>> meant for ordinary people which want make it much, much harder for other
>> ordinary people (or geeks or kernel maintainers) to read the deleted
>> content ever again. It's far too easy to use grep or something similiar
>> to find seemingly deleted stuff at device level again (after it was
>> deleted by what filesystems are offering nowadays). Especially if one
>> thinks at stuff like certificates and similiar which can be identified
>> by common patterns (bit sequences) they use.
> 
> Or to give another more common example: If you delete your contact list,
> I likely might find again by just searching for 0x6f726956 at the device
> level (assuming you've stored a contact in that list with the same
> surname as yours.
> 
> And, because I've only mentioned in a different thread, now think at the
> problem that nowadays storage is often fixed (soldered) to devices which
> don't offer a way to delete the whole storage. You might have luck if
> the contact list in question was stored in some encrypted part, but that
> presumes that the key for that encrypted part isn't somehow stored on
> the same device too. Which unfortunately isn't always the case (maybe
> because of usability). And ...
> 
> That's why I think filesystems should offer a way to really delete
> files. Most people would be happy, even if filesystems won't delete
> stuff at military security levels and would disregard all the cases when
> they couldn't make sure that stuff is really deleted.
> 
> To conclude, most people would be already happy if the most trivial case
> would be handled right and not just by marking files as deleted but
> leaving the contents intact.

Well, one other issue is that this only ensures that the extents referenced 
at the time of explicit deletion are wiped.

On COW filesystems this is most obviously insufficient (All the old 
unreferenced-after-COW copies will have been left in place rather than 
erased in this manner). However, on other filesystems it can still happen 
anyway.

So even just architecturally, this operates at the wrong point in time to 
make the guarantees it's claiming. Secure deletion behavior affects the 
entire filesystem, because it may very well make internal copies, not just 
explicit user-driven ones.

Because of that, it'd pretty much have to be a mount flag of some variety, 
as far as I understand. When enabled, any time an extent is freed, it must 
be wiped. And even then, a single mount with that option disabled would 
destroy any such guarantees.


  parent reply	other threads:[~2015-02-03 16:44 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 17:05 [PATCH 0/5] RFC: Offer a way for userspace to request real deletion of files Alexander Holler
2015-02-02 17:05 ` [PATCH 1/5] WIP: Add syscall unlinkat_s (currently x86* only) Alexander Holler
2015-02-03  6:05   ` Al Viro
2015-02-03  6:58     ` Alexander Holler
2015-02-03  7:56       ` Al Viro
2015-02-03  8:01         ` Alexander Holler
2015-02-03  8:10           ` Al Viro
2015-02-03  8:17             ` Alexander Holler
2015-02-03  8:51         ` Alexander Holler
2015-02-03  9:23           ` Alexander Holler
2015-02-03 12:48             ` Alexander Holler
2015-02-03 12:54               ` Alexander Holler
2015-02-03 17:48               ` Theodore Ts'o
2015-02-03 18:01                 ` Alexander Holler
2015-02-03 23:33                   ` Al Viro
2015-02-04  0:18                     ` Alex Elsayed
2015-02-04  4:16                     ` Andreas Dilger
2015-02-04 10:19                     ` Alexander Holler
2015-02-04 12:07                       ` Lukáš Czerner
2015-02-04 12:22                         ` Alexander Holler
2015-02-04 12:42                           ` Alexander Holler
2015-02-04 12:50                             ` Alexander Holler
2015-02-04 13:07                               ` Alexander Holler
2015-02-04 13:06                           ` Michael Kerrisk
2015-02-04 13:21                             ` Alexander Holler
     [not found]                               ` <54D21CC8.4020705-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04 13:29                                 ` Alexander Holler
     [not found]                                   ` <54D21EB8.6020208-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04 14:19                                     ` Alexander Holler
     [not found]                                       ` <54D22A63.7090603-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04 15:00                                         ` Austin S Hemmelgarn
2015-02-04 14:52                                 ` Lukáš Czerner
     [not found]                                   ` <alpine.LFD.2.00.1502041533130.26766-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-02-04 16:12                                     ` Alexander Holler
2015-02-04 16:25                                       ` Lukáš Czerner
     [not found]                                       ` <alpine.LFD.2.00.15020 41724180.26766@localhost.localdomain>
     [not found]                                         ` <alpine.LFD.2.00.1502041724180.26766-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-02-04 16:45                                           ` Alexander Holler
     [not found]                                             ` <54D24CA5.6080603-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04 16:53                                               ` Alexander Holler
2015-02-04 19:33                                   ` Theodore Ts'o
2015-02-04 19:56                                     ` Alexander Holler
2015-02-03 16:44             ` Alex Elsayed [this message]
2015-02-03  7:58       ` Davidlohr Bueso
2015-02-03  7:52     ` Alexander Holler
     [not found]   ` <1422896713-25367-2-git-send-email-holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04  8:01     ` Michael Kerrisk
2015-02-02 17:05 ` [PATCH 2/5] WIP: fs: fat: support unlinkat_s() for secure deletion of files Alexander Holler
2015-02-02 17:05 ` [PATCH 3/5] WIP: fs: ext4: " Alexander Holler
2015-02-03 13:50   ` Lukáš Czerner
2015-02-03 14:50     ` Alexander Holler
2015-02-03 15:13       ` Alexander Holler
2015-02-03 15:24         ` Alexander Holler
2015-02-03 15:41       ` Lukáš Czerner
2015-02-03 15:46         ` Alexander Holler
2015-02-03 16:38         ` Alexander Holler
2015-02-03 18:50           ` Alexander Holler
2015-02-02 17:05 ` [PATCH 4/5] WIP: Add patch for coreutils to support unlinkat_s (x86_64 only) Alexander Holler
2015-02-02 17:05 ` [PATCH 5/5] WIP: Add test for unlinkat_s Alexander Holler
2015-02-03 15:15 ` [PATCH 0/5] RFC: Offer a way for userspace to request real deletion of files One Thousand Gnomes
2015-02-03 15:45   ` Alexander Holler
     [not found] ` <1422896713-25367-1-git-send-email-holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-02-04  8:01   ` Michael Kerrisk
2015-02-06 12:17 ` Alexander Holler

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='maqtsj$bko$2@ger.gmane.org' \
    --to=eternaleye@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).