]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: bump versions of decoders for upmap-primary 57777/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 May 2024 14:46:25 +0000 (14:46 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 29 May 2024 16:52:56 +0000 (16:52 +0000)
In e9921ee76c06 new revisions for client-usable data of
`OSDMap` (rev 10) and `OSDMap::Incremental` (rev 9) have
been introduced. However, corresponding `DECODE_START` in
decoders haven't been bumped up.

The net effect is a blur between the schemas when somebody
would intentionally (with `malformed_input` being thrown)
want to break compatibility with decoders on those versions
(refer to `struct_compat`).

```
/**
 * start a decoding block
 *
 * @param v current version of the encoding that the code supports/encodes
 * @param bl bufferlist::iterator for the encoded data
 */
  __u8 struct_v, struct_compat; \
  using ::ceph::decode; \
  decode(struct_v, bl); \
  decode(struct_compat, bl); \
  if (v < struct_compat) \
    throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \
  __u32 struct_len; \
  decode(struct_len, bl); \
  if (struct_len > bl.get_remaining()) \
    throw ::ceph::buffer::malformed_input(DECODE_ERR_PAST(__PRETTY_FUNCTION__)); \
  unsigned struct_end = bl.get_off() + struct_len; \
  do {
```

Fixes: https://tracker.ceph.com/issues/66285
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/osd/OSDMap.cc

index 116ccea047f9150452fe264098960abc11ba10e0..bf50b18a8da7a56f2e6bcca03875748113c73b15 100644 (file)
@@ -883,7 +883,7 @@ void OSDMap::Incremental::decode(ceph::buffer::list::const_iterator& bl)
     return;
   }
   {
-    DECODE_START(8, bl); // client-usable data
+    DECODE_START(9, bl); // client-usable data
     decode(fsid, bl);
     decode(epoch, bl);
     decode(modified, bl);
@@ -3548,7 +3548,7 @@ void OSDMap::decode(ceph::buffer::list::const_iterator& bl)
    * Since we made it past that hurdle, we can use our normal paths.
    */
   {
-    DECODE_START(9, bl); // client-usable data
+    DECODE_START(10, bl); // client-usable data
     // base
     decode(fsid, bl);
     decode(epoch, bl);