Ignore PROT_GROWSDOWN and PROT_GROWSUP
PATCH 1/1 Ignore PROT_GROWSDOWN and PROT_GROWSUP
In an mprotect call the flags PROT_GROWSDOWN and PROT_GROWSUP can be defined. Currently qemu returns an EINVAL as soon as one of these is found, which breaks some programs (especially mplayer).
As far as I can tell it is safe to ignore these flags and just go on as if nothing happened. To be on the safe side a warning message to the user is thrown though.
Is there anything wrong with ignoring these? Should they be implemented properly? Comments appreciated.
Alex
linux-user/mmap.c +4 -2
@@ -48,8 +48,10 @@ int target_mprotect(target_ulong start, end = start + len;if (end < start)return -EINVAL ; -if (prot & ~(PROT_READ |PROT_WRITE |PROT_EXEC )) -return -EINVAL ; +if (prot & ~(PROT_READ |PROT_WRITE |PROT_EXEC )) { +gemu_log ("WARNING: dirty hack in mprotect: setting prot (%#x -> %#x)\n" , prot, prot & (PROT_READ |PROT_WRITE |PROT_EXEC )); + prot &= (PROT_READ |PROT_WRITE |PROT_EXEC ); + }if (len ==0 )return 0 ;