All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Ignaz Forster <iforster@suse.de>,
	Goldwyn Rodrigues <rgoldwyn@suse.com>,
	linux-integrity@vger.kernel.org,
	Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org
Subject: Re: EVM: Permission denied with overlayfs
Date: Tue, 18 Dec 2018 18:00:31 -0500	[thread overview]
Message-ID: <1545174031.4178.8.camel@linux.ibm.com> (raw)
In-Reply-To: <12c81a49-efca-d66c-2143-ae04ca248cce@suse.de>

Hi Ignaz,

On Tue, 2018-12-18 at 20:49 +0100, Ignaz Forster wrote:
> Hi,
> 
> as a follow up to my attempts to use overlayfs on an IMA protected 
> system[1] I've now tried to also enable EVM. From what I understand this 
> should - at least in theory - be possible: EVM will call 
> d_backing_inode(dentry), which I thought would get the inode of the 
> underlying file system[2], and use that for HMAC verification.
> 
> In practice simply trying to access an existing file will fail with 
> "Permission denied" already. In the corresponding audit log I can see 
> the file access (failed with "invalid-HMAC"), but with an inode number 
> unknown to me - stat returns a completely different number for the file 
> in the lower and target dir.
> 
> For testing purposes I added a new hashing algorithm to 
> evm_ima_xattr_type which will not add the file system specific 
> attributes (inode number, generation, file system uuid) to the hash - 
> just like EVM_XATTR_PORTABLE_DIGSIG, but with the hashes generated by 
> the kernel. Files created with this signature can be read correctly, 
> though writing the files will still fail.
> 
> Unfortunately I'm out of ideas what is happening here. If anybody wants 
> to have a look at this: Any help would be appreciated.
> 
> Kind Regards,
> Ignaz
> 
> [1] https://www.spinics.net/lists/linux-integrity/msg03593.html
> [2] https://www.kernel.org/doc/htmldocs/filesystems/API-d-backing-inode.html
> 

After creating a file on the overlay, I wasn't able to access it from
the overlay, but was able to access it from "upper".  Both "stat" and
"getfattr -m ^security" returned exactly the same things for both
pathnames.  However, the ino in the audit log was different.

After modifying evm_calc_hmac_or_hash(), replacing d_backing_inode()
with d_real_inode(), the hmac properly calculated for both the overlay
and the upper pathnames.

Something must have changed in d_backing_inode().

Mimi


  reply	other threads:[~2018-12-18 23:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 19:49 EVM: Permission denied with overlayfs Ignaz Forster
2018-12-18 23:00 ` Mimi Zohar [this message]
2018-12-19 15:39   ` Mimi Zohar
2018-12-19 16:38     ` Amir Goldstein
2018-12-19 18:34       ` Mimi Zohar
2018-12-19 20:39         ` Amir Goldstein
2018-12-20  3:42       ` Goldwyn Rodrigues
2018-12-20  7:15         ` Amir Goldstein
2018-12-19 16:56     ` James Bottomley
2018-12-19 18:15       ` Mimi Zohar
2018-12-19 19:34         ` James Bottomley
2018-12-19 20:12           ` Amir Goldstein
2018-12-19 21:02             ` Mimi Zohar
2018-12-19 22:08               ` James Bottomley
2018-12-20 14:55                 ` Mimi Zohar
2018-12-20 19:24                   ` James Bottomley
2018-12-19 22:11             ` James Bottomley
     [not found]     ` <1545234449.3954.14.camel@linux.ibm.com>
     [not found]       ` <CAOQ4uxgG9yu-dOgOZyFnck+=ZjsoDe0SCJ6S-4+s0kB6mH2Maw@mail.gmail.com>
     [not found]         ` <1545245504.3954.51.camel@linux.ibm.com>
2018-12-19 20:47           ` [Fwd: Re: EVM: Permission denied with overlayfs] Amir Goldstein
2018-12-20 10:53             ` Mimi Zohar
2018-12-20 12:04               ` Amir Goldstein
2018-12-20 14:20                 ` Mimi Zohar
2018-12-20 15:56                   ` Amir Goldstein
2018-12-20 16:39                     ` Mimi Zohar

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=1545174031.4178.8.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=iforster@suse.de \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=rgoldwyn@suse.com \
    /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.