From: selinux770@tortenboxer.de
To: selinux@tycho.nsa.gov
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: wrong magic number (using old sources)
Date: Wed, 15 Aug 2007 17:44:07 +0200 [thread overview]
Message-ID: <20070815154407.250820@gmx.net> (raw)
In-Reply-To: <1187009718.26008.19.camel@moss-spartans.epoch.ncsc.mil>
> Are you cross-compiling from a system with different endianness?
Don't think so. I think both systems are little endian.
I played a little bit with the sources and i found a strange error:
Actuallay, the generated magic number is correct. I checked that with an hex editor and also within the next_entry() method in private.h
the buffer, the next_entry method returns is:
buffer[0]: 8c
buffer[1]: ff
buffer[2]: 7c
buffer[3]: f9
buffer[4]: 8
buffer[5]: 0
buffer[6]: 0
buffer[7]: 0
The method returns a void pointer, that is interpreted as an uint32_t (4 bytes) pointer (*buf). Printing the first two buffer entries now, i get:
*** before conversion: buf[0] : 7cff8c
*** after conversion: buf[0] : 8c007cff
*** before conversion: buf[1] : f9000008
*** after conversion: buf[1] : 8f90000
Whereas "before conversion" shows the hex interpretation of buf[i] before le32_to_cpu(buf[i]) is called, and "after conversion" shows the value afterwards. Something wents completely wrong. It seems like a 00 is added at the beginning of buf[0]. The magic number would be correct if we would drop this 00 and take the first byte of buf[1] instead. The strange thing is that, when i declare a
char *tmpbuf;
and set it to
tmpbuf=(char *)buf;
the content is correct again:
*** buf as char: tmpbuf[0] : 8c
*** buf as char: tmpbuf[1] : ff
*** buf as char: tmpbuf[2] : 7c
*** buf as char: tmpbuf[3] : f9
*** buf as char: tmpbuf[4] : 8
*** buf as char: tmpbuf[5] : 0
*** buf as char: tmpbuf[6] : 0
*** buf as char: tmpbuf[7] : 0
I don't get the problem... why is
buf[0] = (00) 7c ff 8c and
(char *) buf[3...0] = f9 7c ff 8c
?
This is obviously not an error within the selinux sources, but maybe you could help me anyway?!
Thanks in advance.
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
--
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.
next prev parent reply other threads:[~2007-08-15 15:44 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 [this message]
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
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=20070815154407.250820@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.