Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7140985

HSDIS does not handle caller options correctly

XMLWordPrintable

    • b16
    • x86
    • linux_redhat_5.0
    • Not verified

        FULL PRODUCT VERSION :
        java version "1.6.0_20"
        OpenJDK Runtime Environment (IcedTea6 1.9.10) (fedora-55.1.9.10.fc14-x86_64)
        OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)


        FULL OS VERSION :
        Linux zebedee.pink 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


        A DESCRIPTION OF THE PROBLEM :
        I'm trying to pass an argument to hsdis as a caller option. It's
        not being handled correctly, and I think this is the reason:

        static void parse_caller_options(struct hsdis_app_data* app_data, const char* caller_options) {
          char* iop_base = app_data->insn_options;
          char* iop_limit = iop_base + sizeof(app_data->insn_options) - 1;
          char* iop = iop_base;
          const char* p;
          for (p = caller_options; p != NULL; ) {
            const char* q = strchr(p, ',');
            size_t plen = (q == NULL) ? strlen(p) : ((q++) - p);
            if (plen == 4 && strncmp(p, "help", plen) == 0) {
              print_help(app_data, NULL, NULL);
            } else if (plen >= 5 && strncmp(p, "mach=", 5) == 0) {
              char* mach_option = app_data->mach_option;
              size_t mach_size = sizeof(app_data->mach_option);
              mach_size -= 1; /*leave room for the null*/
              if (plen > mach_size) plen = mach_size;
              strncpy(mach_option, p, plen);
              mach_option[plen] = '\0';
            } else if (plen > 6 && strncmp(p, "hsdis-", 6)) {

        Should this be
            ! strncmp(p, "hsdis-", 6)) {

        -----------------------------------------------------------------------------
          Subject: Re: hsdis and caller options
          From: John Rose
        Date: Thu, 19 Jan 2012 12:02:48 -0800
        Cc: hotspot-dev Source Developers <###@###.###>

        On Jan 19, 2012, at 9:37 AM, Andrew Haley wrote:

        > I'm trying to pass an argument to hsdis as a caller option. It's
        > not being handled correctly, and I think this is the reason:
        >

        ...

        > Should this be
        > ! strncmp(p, "hsdis-", 6)) {

        You are correct; that's a bug.

        -- John


        THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

        THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        See the thread at hotspot-dev:

        http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-January/005031.html

        REPRODUCIBILITY :
        This bug can be reproduced always.

              kvn Vladimir Kozlov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: