Bug 186344 - checkpolicy does not work on PowerPC
Summary: checkpolicy does not work on PowerPC
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: checkpolicy
Version: 5
Hardware: powerpc
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-03-23 01:35 UTC by W. Michael Petullo
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version: 1.12.4-1.fc5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-05-09 20:58:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File generated on PowerPC as requested (1.01 KB, application/octet-stream)
2006-03-24 15:33 UTC, W. Michael Petullo
no flags Details
Source code to policy fragment (244 bytes, text/plain)
2006-03-24 16:11 UTC, W. Michael Petullo
no flags Details
Convert num_decls to little endian prior to writing it to the module. (731 bytes, patch)
2006-03-24 16:34 UTC, Stephen Smalley
no flags Details | Diff

Description W. Michael Petullo 2006-03-23 01:35:57 UTC
Description of problem:


Version-Release number of selected component (if applicable):
checkpolicy-1.29.4-1

How reproducible:
Every time

Steps to Reproduce:
1.  Create the following local.te:

module local 1.0;

require {
        role object_r;
        role system_r;

        class fifo_file getattr;
        class fifo_file write;

        type httpd_sys_content_t;
        type httpd_sys_script_t;
};

allow httpd_sys_script_t httpd_sys_content_t:fifo_file { getattr write };

2.  checkmodule -M -m -o appliance-config.mod appliance-config.te

3.  semodule_package -o appliance-config.pp -m appliance-config.mod
  
Actual results:
security: conditional expressions uses unknown operator.
semodule_package:  Error while reading policy module from appliance-config.mod

Expected results:
the policy module should be processed correctly as it is on i386.

Additional info:
I am using the following packages:

selinux-policy-2.2.23-15
libselinux-python-1.29.7-1.2
libselinux-1.29.7-1.2
selinux-policy-targeted-2.2.23-15
policycoreutils-1.29.26-6
checkpolicy-1.29.4-1

Comment 1 Stephen Smalley 2006-03-23 14:26:38 UTC
Don't have ppc hardware myself, and the above sequence worked on x86.
Can you attach the .mod file to this bug report please?

There was a bug fix in libsepol 1.12.1 to fix a problem in
sepol_module_package_write, but your bug report suggests a problem during the
reading of the binary policy module file, so likely not relevant.

Comment 2 W. Michael Petullo 2006-03-24 15:33:11 UTC
Created attachment 126637 [details]
File generated on PowerPC as requested

Comment 3 Joshua Brindle 2006-03-24 15:40:14 UTC
Can you also attach the source used to generate this binary please?

Comment 4 Stephen Smalley 2006-03-24 16:08:11 UTC
I'm assuming the source is what he listed in the bug report originally
as local.te (which had no conditionals at all).  Is that correct?


Comment 5 W. Michael Petullo 2006-03-24 16:11:59 UTC
Created attachment 126643 [details]
Source code to policy fragment

This is the source code to the policy fragment.  It should match what was
posted earlier.

Comment 6 Stephen Smalley 2006-03-24 16:24:43 UTC
Yes, that matches.  Joshua - he is compiling with -M, so keep that in mind.
Compiling it locally on x86 and comparing the two .mod files, they differ at
bytes 406 (1 vs. 0) and 409 (0 vs. 1).

Comment 7 Stephen Smalley 2006-03-24 16:34:45 UTC
Created attachment 126652 [details]
Convert num_decls to little endian prior to writing it to the module.

Given the info so far, I started looking for cases where we might be writing
out module data without converting to little endian, as all of the data is
supposed to be written out in that form and converted back upon reading.  Looks
like avrule_block_write was missing a case.  Please review attached patch. 
Note that libsepol must be rebuilt and then checkpolicy rebuilt against it, as
checkpolicy uses the static lib.

Comment 8 Stephen Smalley 2006-03-24 17:10:27 UTC
Patch applied to libsepol 1.12.2 upstream.


Comment 9 Daniel Walsh 2006-05-09 20:58:56 UTC
Fixed in libsepol 1.12.4-1.fc5



Note You need to log in before you can comment on or make changes to this bug.