[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 1/3] xen/flask: Drop the gen-policy.py script



On Sat, Dec 7, 2019 at 9:17 PM Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>
> The script is Python 2 specific, and fails with string/binary issues with
> Python 3:
>
>   Traceback (most recent call last):
>     File "gen-policy.py", line 14, in <module>
>       for char in sys.stdin.read():
>     File "/usr/lib/python3.5/codecs.py", line 321, in decode
>       (result, consumed) = self._buffer_decode(data, self.errors, final)
>   UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8c in position 0: 
> invalid start byte
>
> Fixing the script to be compatible isn't hard, but using python here is
> wasteful.  Drop the script entirely, and write a short flask-policy.S instead.

It might be helpful for casual reviewers to have a slightly better
explanation of what the change is; namely:

- The end goal is to have a .o file exporting one variable containing
the contents of policy.bin, and another containing its size.

- gen-policy.py generates a C file which contains the bytes of
policy.bin (and its size).  This means running python, and then a c
compiler.

- The replacement use a .S file to "include" the binary directly.
This involves only running an assembler, but has the same end effect.

This looks like a good change; but I don't know assembler well enough
to give it an R-b.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.