All of lore.kernel.org
 help / color / mirror / Atom feed
From: selinux770@tortenboxer.de
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@tycho.nsa.gov
Subject: Re: wrong magic number (using old sources)
Date: Thu, 16 Aug 2007 17:14:07 +0200	[thread overview]
Message-ID: <20070816151407.290970@gmx.net> (raw)
In-Reply-To: <1187269164.909.8.camel@moss-spartans.epoch.ncsc.mil>

> Ok, so libsepol needs to be fixed in the same way the kernel was to
> eliminate unaligned accesses.  Might take a little bit to work through
> all the code.  The size of the buffer has to be large enough for the
> largest next_entry() request.
> 
> As a possible short term work around, you might try this patch instead.
> It just converts the static buffer used within libsepol from unsigned
> char to uint32_t so that the buffer will be aligned (at least for u32).
> That avoids changing all the callers.

This smal patch worked fine for me. The policy is created and loaded (correctly I think :-)).

Thanks a lot for you support.


 
> Index: libsepol/src/private.h
> ===================================================================
> --- libsepol/src/private.h	(revision 2517)
> +++ libsepol/src/private.h	(working copy)
> @@ -5,6 +5,7 @@
>  #include <byteswap.h>
>  #include <endian.h>
>  #include <sepol/policydb/policydb.h>
> +#include <stdint.h>
>  
>  #if __BYTE_ORDER == __LITTLE_ENDIAN
>  #define cpu_to_le16(x) (x)
> @@ -39,7 +40,7 @@
>  /* Reading from a policy "file". */
>  static inline void *next_entry(struct policy_file *fp, size_t bytes)
>  {
> -	static unsigned char buffer[BUFSIZ];
> +	static uint32_t buffer[20];
>  	size_t nread;
>  
>  	if (bytes > sizeof buffer)
> 
> -- 
> Stephen Smalley
> National Security Agency

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2007-08-16 15:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 10:10 wrong magic number (using old sources) selinux770
2007-08-10 11:45 ` Stephen Smalley
2007-08-10 11:55   ` Stephen Smalley
2007-08-10 12:12   ` selinux770
2007-08-10 12:21     ` Stephen Smalley
2007-08-10 13:07       ` "Björn Vogel"
2007-08-10 13:19         ` Stephen Smalley
2007-08-10 14:12           ` selinux770
2007-08-11 18:07             ` selinux770
2007-08-13 12:55               ` Stephen Smalley
2007-08-15 15:44                 ` selinux770
2007-08-15 18:33                   ` Stephen Smalley
2007-08-16  8:05                     ` selinux770
2007-08-16 12:59                       ` Stephen Smalley
2007-08-16 15:14                         ` selinux770 [this message]
2007-08-21 17:05                         ` [patch] libsepol: eliminate unaligned accesses (Was: Re: wrong magic number (using old sources)) Stephen Smalley
2007-08-21 19:21                           ` Eric Paris
2007-08-21 19:33                             ` Stephen Smalley
2007-08-23 15:08                           ` Stephen Smalley

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=20070816151407.290970@gmx.net \
    --to=selinux770@tortenboxer.de \
    --cc=sds@tycho.nsa.gov \
    --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.