From: Oren Laadan <orenl@librato.com>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Oren Laadan <orenl@cs.columbia.edu>,
Linux Containers <containers@lists.osdl.org>,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2/4] cr: add generic LSM c/r support (v5)
Date: Fri, 16 Oct 2009 13:03:38 -0400 [thread overview]
Message-ID: <4AD8A76A.8030201@librato.com> (raw)
In-Reply-To: <20091015170630.GA25069@us.ibm.com>
Serge E. Hallyn wrote:
> Quoting Oren Laadan (orenl@librato.com):
> ...
>>> + switch (sectype) {
>>> + case CKPT_SECURITY_MSG_MSG:
>>> + str = security_msg_msg_checkpoint(security);
>>> + break;
>>> + case CKPT_SECURITY_IPC:
>>> + str = security_ipc_checkpoint(security);
>>> + break;
>>> + case CKPT_SECURITY_FILE:
>>> + str = security_file_checkpoint(security);
>>> + break;
>>> + case CKPT_SECURITY_CRED:
>>> + str = security_cred_checkpoint(security);
>>> + break;
>>> + default:
>>> + str = ERR_PTR(-EINVAL);
>>> + break;
>>> + }
>> Let me suggest a different scheme (also last night's IRC); I think it's
>> less hackish and uses better the existing {checkpoint,restore}_obj().
>>
>> * Define one obj type CKPT_OBJ_SEC_{IPC, MSG_MSG, FILE, CRED}, with
>> matching c/r functions security_{c,r}_{ipc,msg_msg,file,cred}_obj()
>>
>> * Define one obj type for the string representation CKPT_OBJ_SEC_STR
>> with matchin c/r functions security_{c,r}_string_obj()
>>
>> * The helper will now:
>>
>> security_checkpoint_obj()
>> {
>> switch (type) {
>> case CKPT_OBJ_SEC_IPC:
>> ret = checkpoint_obj(ctx, sec, CKPT_OBJ_SEC_IPC);
>> break;
>> case CKPT_OBJ_SEC_CRED:
>> ret = checkpoint_obj(ctx, sec, CKPT_OBJ_SEC_CRED);
>> ...
>> }
>>
>> security_checkpoint_ipc_obj()
>> {
>> ...
>> ckpt_lsm_str = str_from_sec_ipc(); /* like you do now */
>> objref = checkpoint_obj(ctx, ckpt_lsm_str, CKPT_OBJ_SEC_STR);
>> ...
>> h->objref = objref;
>> ckpt_write_obj();
>> }
>>
>> Perhaps a variation on this where the string is checkpoint_obj()'ed
>> first would also work.
>>
>> I haven't looked at all the details, but I hope something along these
>> lines would help untangle the current mess.
>
> So as discussed on irc, that by itself won't work bc (a) smack
> will checkpoint the same void* as multiple objtypes, and the
> objhash will complain.
>
> Since we've gone over several possibilities on irc, let me summarize
> some here:
>
> 1. do the restore_security() in the code instead of using an objref
> to have it called automatically. That stops me having to write an
> objref by hand before writing out the CKT_HDR_CRED. That's fine
> with me, but then I won't be using checkpoint_obj() either, so I
> want to make sure I'm not going to change all the restore callers
> just to end up nixing that path.
This is similar to how pipes/fifo are handled: first check for a
common inode (CKPT_OBJ_INODE only used during restart).
I agree that it is not as pretty to use it for security void* that
are kind of an independent shared object. However, it is clean.
>
> 2. alter the objhash to not complain if the same void* is checkpointed
> as a different type. That may have safety implications for the rest
> of the objhash users, especially at restart where we can't really trust the
> input.
Agree with your concerns, this is not my favorite.
>
> 3. have security_checkpoint_obj() 'reserve' a dummy objsec by
> stuffing the void* security, then assume that the objref for
> the string representation will be objref(void*security)+1.
> This might cause problems if we later parallelize checkpoint so
> that objref+1 is no longer valid.
I don't like this. Too hacky.
>
> 4. Add a new field to the struct ckpt_obj which lets us store
> the objref for the string pointer in the ckpt_obj for the void*.
Can you elaborate on what this entails ?
E.g., do you want to be able to store an arbitrary data field for
an object, and add interface to set and get it ? (If so, what is
the proposed api ?)
>
> For completeness, the latest version which I actually sent out
> did:
>
> 5. Define two objhash object types for the lsm obj, one to
> use at checkpoint, and one at restart. At checkpoint, it
> stuffs the void* security into the objhash and manually writes
> out a checkpoint entry for the context string. At restart, it
> places a struct containing the context string in the objhash.
> The type used at restart must have ->get/->drop defined so that
> the struct is freed at the end of restart, while at checkpoint
> we can't hvae ->get/->drop bc the void* is opaque (and persistand
> relative to the checkpoint operation).
:(
>
> And what I was starting on until the latest irc conversation
> was (3).
>
> At the moment (4) seems to me like the best path.
There is a 6th option: allow callers of checkpoint_obj() to pass
another arbitrary argument to the obj-type-specific checkpoint
function. So you'd pass the type of the security void* along to
it.
Oren.
next prev parent reply other threads:[~2009-10-16 17:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-09 20:55 [PATCH 1/4] debug: add a few ckpt_debugs Serge E. Hallyn
[not found] ` <20091009205552.GA5778-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-09 20:56 ` [PATCH 2/4] cr: add generic LSM c/r support (v5) Serge E. Hallyn
[not found] ` <20091009205626.GA5823-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-15 14:57 ` Oren Laadan
2009-10-15 17:06 ` Serge E. Hallyn
2009-10-16 17:03 ` Oren Laadan [this message]
2009-10-16 17:41 ` Serge E. Hallyn
2009-10-09 20:56 ` [PATCH 3/4] cr: add smack support to lsm c/r (v4) Serge E. Hallyn
2009-10-09 20:57 ` [PATCH 4/4] cr: add selinux support (v6) Serge E. Hallyn
2009-10-09 20:57 ` Serge E. Hallyn
[not found] ` <20091009205731.GC5823-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-09 21:15 ` Daniel J Walsh
2009-10-09 21:15 ` Daniel J Walsh
[not found] ` <4ACFA7F1.6060209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-10-09 22:31 ` Serge E. Hallyn
2009-10-09 22:31 ` Serge E. Hallyn
2009-10-14 22:41 ` [PATCH 1/4] debug: add a few ckpt_debugs Oren Laadan
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=4AD8A76A.8030201@librato.com \
--to=orenl@librato.com \
--cc=containers@lists.osdl.org \
--cc=linux-security-module@vger.kernel.org \
--cc=orenl@cs.columbia.edu \
--cc=serue@us.ibm.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.