Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7519

Fix flags field overflow in WT_DATA_HANDLE

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.7, 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines

      According to a comment in include/dhandle.h the flags field of WT_DATA_HANDLE should only use 8 values.  But there are 9 possible values defined there:

      /* Flags values over 0xff are reserved for WT_BTREE_* */
      /* AUTOMATIC FLAG VALUE GENERATION START */
      #define WT_DHANDLE_DEAD 0x001u         /* Dead, awaiting discard */
      #define WT_DHANDLE_DISCARD 0x002u      /* Close on release */
      #define WT_DHANDLE_DISCARD_KILL 0x004u /* Mark dead on release */
      #define WT_DHANDLE_DROPPED 0x008u      /* Handle is dropped */
      #define WT_DHANDLE_EXCLUSIVE 0x010u    /* Exclusive access */
      #define WT_DHANDLE_HS 0x020u           /* History store table */
      #define WT_DHANDLE_IS_METADATA 0x040u  /* Metadata handle */
      #define WT_DHANDLE_LOCK_ONLY 0x080u    /* Handle only used as a lock */
      #define WT_DHANDLE_OPEN 0x100u         /* Handle is open */
                                             /* AUTOMATIC FLAG VALUE GENERATION STOP */
      

      I don't understand the restriction of flag values here, but this looks like an accident waiting to happen and should be fixed.

      (Alternately, perhaps the comment is out of data or misleading, in which case it should be fixed instead.)

            Assignee:
            keith.smith@mongodb.com Keith Smith
            Reporter:
            keith.smith@mongodb.com Keith Smith
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: