All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Antill <jantill@redhat.com>
To: Karl MacMillan <kmacmillan@mentalrootkit.com>
Cc: SELinux Mail List <selinux@tycho.nsa.gov>
Subject: Re: [RFC] Support for bzip compressed modules
Date: Wed, 10 Jan 2007 00:06:57 -0500	[thread overview]
Message-ID: <1168405617.13080.22.camel@code.and.org> (raw)
In-Reply-To: <1168377502.4983.12.camel@localhost.localdomain>

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

On Tue, 2007-01-09 at 16:18 -0500, Karl MacMillan wrote:
> On Tue, 2007-01-09 at 11:50 -0500, James Antill wrote:
> >  Do policy files not have a magic value, then?
> 
> They do, but there is no real restriction that these policy file things
> get used for files containing policy. Currently they are used for a
> variety of file types and I would hate to hard code a list valid file
> types into this function.

 I don't think I'm intelligent enough to understand this sentence :).
What I meant was if they have magic values, they'll never clash so it's
always ok to do the check, no?
 Or in the other direction, if you can't differentiate on magic value or
the filename how can any piece of code tell whether it should decompress
it or treat it as raw data?

> >  You can also (for bz2)
> > check that the next value is between 1 and 9 (it's the compression
> > ratio).
> 
> Ok. Could this be used for sizing the buffer in the memory case?

 No, it's just the "how hard did you want to try" value. So something
compressed with "bzip2 -1" will have a '1' and likewise "bzip2 -9" will
have a '9' after the magic.

> >  Right, but as I said the error paths always just try again without
> > compression ... so why not just try the compression at the start of the
> > set_foo() code. You get the same behaviour.
> > 
> 
> It is not about returning information about the compression. It is
> because the compression routines have other error paths (failure to load
> libbz2, memory allocation, etc.). There is no good way to indicate those
> errors without changing the prototypes. Even if we didn't change the
> prototypes, it is valid to not check the current functions for error, so
> we can't change them in any way that has potential error paths.

 Yes, I know that ... but there isn't a difference in the return value
between "bz2_init() failed" and "is_bz2_file() returned NO". So all the
callers just assume the later for all errors, if that's the case we
might as well combine it back into set_foo().

-- 
James Antill - <james.antill@redhat.com>
setsockopt(fd, IPPROTO_TCP, TCP_CONGESTION, ...);
setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, ...);
setsockopt(fd, SOL_SOCKET,  SO_ATTACH_FILTER, ...);


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

  reply	other threads:[~2007-01-10  5:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-08 20:34 [RFC] Support for bzip compressed modules Karl MacMillan
2007-01-09  7:18 ` James Antill
2007-01-09 15:51   ` Karl MacMillan
2007-01-09 15:58     ` Stephen Smalley
2007-01-09 16:50     ` James Antill
2007-01-09 21:18       ` Karl MacMillan
2007-01-10  5:06         ` James Antill [this message]
2007-01-11 18:41           ` Karl MacMillan
2007-01-09 22:33   ` Russell Coker
2007-01-11 18:48     ` Karl MacMillan

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=1168405617.13080.22.camel@code.and.org \
    --to=jantill@redhat.com \
    --cc=kmacmillan@mentalrootkit.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.