All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Antill <jantill@redhat.com>
To: jbrindle@tresys.com
Cc: selinux@tycho.nsa.gov
Subject: Re: [PATCH 00/33] libsemanage/libsepol object serialization and ps-api
Date: Wed, 25 Apr 2007 00:46:19 -0400	[thread overview]
Message-ID: <1177476379.20127.86.camel@code.and.org> (raw)
In-Reply-To: <1177456360.20127.83.camel@code.and.org>

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

On Tue, 2007-04-24 at 19:12 -0400, James Antill wrote:
> On Mon, 2007-04-23 at 17:34 -0400, jbrindle@tresys.com wrote:
> > This is the majority of the patches from the policy server release a few months ago. This implements object serialization to send objects (eg., booleans, file contexts, etc) across the line to the policy server. It also implements the line protocol to connect to the policy server and the backend for libsemanage so that semodule, semanage, etc will talk to a policy server instead of doing local operations.
> > 
> > The object serialization will also be necessary for the policy representation branch as we will use this infrastructure to serialize the policy tree for module reading and writing.
> > 
> > The only part left for the policy server is the hooks that were implemented in the expander. As the policy representation work is going on and should remove the expander entirely these patches will have to wait until we have enough of the new representation work to implement them there.
> > 
> > This is obviously meant only for trunk and the policyrep branch.
> 
>  Karl asked me to have a look at this, and I haven't looked at all of
> it ... but what I have seen worries me a bit.


 Here's the first parts:

[patch 01]
 
int sepol_serialize(sepol_handle_t * handle,
		    const void *datum,
		    size_t datum_length,
		    unsigned int datum_type, char **data, uint64_t * size)
		    
 This is better fixed by Karl's suggestion of not having a single function, but having datum_length which is ignored for SEPOL_SERIAL_INT32_T etc. is confusing.

 The serialization for SEPOL_SERIAL_STRING:
  Why are you using snprintf()?
  You are moving datum_length into status (size_t into int), which is just asking for pain.

int sepol_unserialize(sepol_handle_t * handle,
		char **data, uint64_t * size,
		void **datum,
		size_t ** datum_length,
		unsigned int datum_type)

SEPOL_SERIAL_STRING_ARRAY:
                               /* Datum. */
				*datum =
					calloc(sizeof(char *),
							sizeof(char *) * (**datum_length));

 I'm pretty sure you want calloc(sizeof(char *), **datum_length);

[patch 10]

 
 int dbase_serialize(struct semanage_handle *handle,
		    dbase_config_t * dconfig,
		    char **data, uint64_t * data_length)

 size_t can still be 32bits, so storing uint64_t's in it might be bad.
 I'm not sure I understand what the completed_count is doing, are you leaking anything if the calloc() fails? I think you want to free upto count all the time. 

[patch 12]
 semanage_serialize is an exact copy of sepol_serialize, AFAICS, so see above.
 
[patch 16]

 I assume semanage_fcontext_get_con(fcontext) doesn't allocate anything, still it'd be nice to not call it twice and just reuse con.
 
 I worry about having semanage_fcontext_unserialize() leave fcontext allocated on failure. A bunch of code does this with arrays ... but even so.
 
[patch 21]
 
 Dito. user_extra is left allocated on the failure path, in semanage_user_extra_unserialize.
 Dito. user is left allocated on the failure path, in semanage_user_unserialize.
 
[patch 22]
  
 for (i = 0; i < *modules_size; i++) {
		/* Module name. */
		status = semanage_unserialize(handle, data, size, (void **)&(*modules)[i].name, &temp_size, SEMANAGE_SERIAL_STRING);
		if (status != STATUS_SUCCESS)
			goto cleanup;

		/* Module version. */
		status = semanage_unserialize(handle, data, size, (void **)&(*modules)[i].version, &temp_size, SEMANAGE_SERIAL_STRING);
		if (status != STATUS_SUCCESS)
		        goto cleanup;
}

 temp_size is allocated on _each call_ to unserialize. 
 
[patch 23]
 
 Why are you calling serialize twice, INT32_T is a fixed size, no?

-- 
James Antill <jantill@redhat.com>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2007-04-25  4:46 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 21:34 [PATCH 00/33] libsemanage/libsepol object serialization and ps-api jbrindle
2007-04-23 21:34 ` [PATCH 01/33] libsepol: basic serilization support jbrindle
2007-04-24 20:00   ` Karl MacMillan
2007-04-24 22:29     ` Joshua Brindle
2007-04-25  4:49       ` Karl MacMillan
2007-04-25 14:14         ` Joshua Brindle
2007-04-25 15:16           ` Karl MacMillan
2007-04-25 15:21             ` Joshua Brindle
2007-04-25 15:40               ` Karl MacMillan
2007-04-25 15:52                 ` Joshua Brindle
2007-04-25 16:00                   ` Karl MacMillan
2007-04-25 16:25                     ` Joshua Brindle
2007-04-25 17:11                       ` James Antill
2007-04-25 18:08                         ` Karl MacMillan
2007-04-23 21:34 ` [PATCH 02/33] libsepol: boolean serialization jbrindle
2007-04-25  4:56   ` Karl MacMillan
2007-04-23 21:34 ` [PATCH 03/33] libsepol: context serialization jbrindle
2007-04-23 21:34 ` [PATCH 04/33] libsepol: interface serialization jbrindle
2007-04-23 21:35 ` [PATCH 05/33] libsepol: node serialization jbrindle
2007-04-23 21:35 ` [PATCH 06/33] libsepol: port serialization jbrindle
2007-04-23 21:35 ` [PATCH 07/33] libsepol: user serialization jbrindle
2007-04-23 21:35 ` [PATCH 08/33] libsemanage: DESTDIR support in INCLUDE and safe test target jbrindle
2007-04-23 21:35 ` [PATCH 09/33] libsemanage: dbase/dconfig cleanup jbrindle
2007-04-23 21:35 ` [PATCH 10/33] libsemanage: database serialization jbrindle
2007-04-23 21:35 ` [PATCH 11/33] libsemanage: endianness macros jbrindle
2007-04-23 21:35 ` [PATCH 12/33] libsemanage: basic serialization jbrindle
2007-04-24 21:16   ` Karl MacMillan
2007-04-24 22:31     ` Joshua Brindle
2007-04-24 22:39       ` Karl MacMillan
2007-04-23 21:35 ` [PATCH 13/33] libsemanage: testing infrastructure jbrindle
2007-04-23 21:35 ` [PATCH 14/33] libsemanage: boolean serialization jbrindle
2007-04-23 21:35 ` [PATCH 15/33] libsemanage: context serialization jbrindle
2007-04-23 21:35 ` [PATCH 16/33] libsemanage: fcontext serialization jbrindle
2007-04-23 21:35 ` [PATCH 17/33] libsemanage: interface serialization jbrindle
2007-04-23 21:35 ` [PATCH 18/33] libsemanage: node serialization jbrindle
2007-04-23 21:35 ` [PATCH 19/33] libsemanage: port serialization jbrindle
2007-04-23 21:35 ` [PATCH 20/33] libsemanage: seuser serialization jbrindle
2007-04-23 21:35 ` [PATCH 21/33] libsemanage: user serialization jbrindle
2007-04-23 21:35 ` [PATCH 22/33] libsemanage: module serialization jbrindle
2007-04-23 21:35 ` [PATCH 23/33] libsemanage: commit number serialization jbrindle
2007-04-23 21:35 ` [PATCH 24/33] libsemanage: networking support jbrindle
2007-04-23 21:35 ` [PATCH 25/33] libsemanage: policy server database hooks jbrindle
2007-04-24 21:39   ` Karl MacMillan
2007-04-24 22:39     ` Joshua Brindle
2007-04-24 23:20       ` Karl MacMillan
2007-04-24 23:57         ` Joshua Brindle
2007-04-25  4:42           ` Karl MacMillan
2007-04-23 21:35 ` [PATCH 26/33] libsemanage: module serialization tests jbrindle
2007-04-23 21:35 ` [PATCH 27/33] libsemanage: booleans " jbrindle
2007-04-23 21:35 ` [PATCH 28/33] libsemanage: fcontexts " jbrindle
2007-04-23 21:35 ` [PATCH 29/33] libsemanage: interface " jbrindle
2007-04-23 21:35 ` [PATCH 30/33] libsemanage: node " jbrindle
2007-04-23 21:35 ` [PATCH 31/33] libsemanage: port " jbrindle
2007-04-23 21:35 ` [PATCH 32/33] libsemanage: seuser " jbrindle
2007-04-23 21:35 ` [PATCH 33/33] libsemanage: user " jbrindle
2007-04-24 19:48 ` [PATCH 00/33] libsemanage/libsepol object serialization and ps-api Joshua Brindle
2007-04-24 23:12 ` James Antill
2007-04-25  4:46   ` James Antill [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=1177476379.20127.86.camel@code.and.org \
    --to=jantill@redhat.com \
    --cc=jbrindle@tresys.com \
    --cc=selinux@tycho.nsa.gov \
    /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.