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

Re: [PATCH 2/6] tools/pygrub: Fix bug in LIMIT_FSIZE env variable override



On 06/11/2023 3:05 pm, Alejandro Vallejo wrote:
> The env variable must be interpreted as an integer. As it is, the override
> logic simply causes an exception.

Fixes: e0342ae5556f ("tools/pygrub: Deprivilege pygrub")

> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
> ---
>  tools/pygrub/src/pygrub | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
> index 08540ad288..327cf51774 100755
> --- a/tools/pygrub/src/pygrub
> +++ b/tools/pygrub/src/pygrub
> @@ -89,7 +89,7 @@ def downgrade_rlimits():
>      # write permissions are bound.
>      fsize = LIMIT_FSIZE
>      if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
> -        fsize = os.environ["PYGRUB_MAX_FILE_SIZE_MB"] << 20
> +        fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
>  
>      resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))
>  

This change on its own is correct, so Acked-by: Andrew Cooper
<andrew.cooper3@xxxxxxxxxx>

However, there's a bug/misfeature which you've copied in patch 3, so
I've inserted a patch 2.5 to try and fix it in a nice order.  It's
probably a little rude to merge the pythonic-fix into this functional fix.

~Andrew



 


Rackspace

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