Disallow flags with extra characters appended

David Holmes david.holmes at oracle.com
Fri Dec 5 03:46:41 UTC 2014


Hi Jesper,

On 5/12/2014 11:38 AM, Jesper Wilhelmsson wrote:
> Hi,
>
> Today some (not all) flags are accepted even though they have random
> characters appended to them. Some examples are -Xconcgc, -Xcomp,
> -Xboundthreads, -XX:+AlwaysTenure etc which will also be accepted when
> written for instance -Xconcgcnoway, -Xcomposer, -Xboundthreadstodogs or
> -XX:+AlwaysTenureAtBlueMoon
>
> There is a potential problem here since we will also accept things like
> -XX:+ExtendedDTraceProbes-XX:+UseG1GC without saying a word (and of
> course without running with G1).
>
> I have a suggestion for a fix here:
> http://cr.openjdk.java.net/~jwilhelm/commandLineFlag/webrev.00/
>
> Would this be an acceptable solution?

I'm somewhat surprised the single name version of match_option didn't 
also have the _tail_allowed flag - seems rather unbalanced. But what you 
have is cleaner I think. Though I would suggest moving you new version:

  static bool match_option(const JavaVMOption *option, const char* name) {

to immediately after the tail version (and before the _tail_allowed 
multi-name version), which a suitable comment added.

That said ...

> I couldn't find one, but since this has been around for quite some time
> I wonder if there is a bug for this already. If not I'll create one.

... this has already been rejected

https://bugs.openjdk.java.net/browse/JDK-6522873

Thanks,
David

> Thanks,
> /Jesper
>


More information about the hotspot-dev mailing list