Project

General

Profile

Actions

Bug #67169

open

common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`

Added by Dhairya Parmar over 1 year ago. Updated 5 months ago.

Status:
Pending Backport
Priority:
Normal
Category:
Correctness/Safety
Target version:
% Done:

0%

Source:
Q/A
Backport:
quincy,reef,squid
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Labels (FS):
Pull request ID:
Tags (freeform):
backport_processed
Fixed In:
v19.3.0-5756-gadc6f2dbb5
Released In:
v20.2.0~1728
Upkeep Timestamp:
2025-11-01T01:03:02+00:00

Description

This came up from QA team,

$ setfattr -n ceph.quota.max_bytes -v 1TG /mnt/ceph-fuse/test_quota/
$ setfattr -n ceph.quota.max_bytes -v 1GT /mnt/ceph-fuse/test_quota/
$ setfattr -n ceph.quota.max_bytes -v KT /mnt/ceph-fuse/test_quota/
$ getfattr -n ceph.quota.max_bytes /mnt/ceph-fuse/test_quota/
getfattr: Removing leading '/' from absolute path names
file: mnt/ceph-fuse/test_quota/ ceph.quota.max_bytes="1024" 

The function strict_iec_cast() is implemented in such a way that it only checks for first char i.e. when you apply TG it considers it as Ti, GT as Gi and KT as Ki. This looks to be a corner case but the issue is this is the common code (from ceph/src/common/strtol.cc) i.e. this function is used across ceph and and not only limited to CephFS. Currently used at:

./mds/Server.cc:5971:      int64_t q = strict_iec_cast<int64_t>(value, &cast_err);
./mon/OSDMonitor.cc:8320:    n = strict_iec_cast<int64_t>(val, &interr);
./rgw/rgw_admin.cc:3745:      max_size = strict_iec_cast<long long>(val, &err);

Also add testcases in src/test/strtol.cc


Related issues 4 (1 open3 closed)

Has duplicate CephFS - Bug #67226: ceph.quota.max_bytes accepting Invalid valuesDuplicateNeeraj Pratap Singh

Actions
Copied to CephFS - Backport #68708: squid: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`ResolvedNeeraj Pratap SinghActions
Copied to CephFS - Backport #68709: reef: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`QA TestingNeeraj Pratap SinghActions
Copied to CephFS - Backport #68710: quincy: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`RejectedNeeraj Pratap SinghActions
Actions #1

Updated by Dhairya Parmar over 1 year ago

  • Subject changed from common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT` to common/strtol: fix @strict_iec_cast@ which parses inputs like @TG@ or @GT@
Actions #2

Updated by Dhairya Parmar over 1 year ago

  • Subject changed from common/strtol: fix @strict_iec_cast@ which parses inputs like @TG@ or @GT@ to common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`
Actions #3

Updated by Dhairya Parmar over 1 year ago

  • Description updated (diff)
Actions #4

Updated by Venky Shankar over 1 year ago

  • Assignee set to Dhairya Parmar
  • Target version set to v20.0.0
  • Backport set to quincy,reef,pacific
Actions #5

Updated by Patrick Donnelly over 1 year ago

  • Has duplicate Bug #67226: ceph.quota.max_bytes accepting Invalid values added
Actions #6

Updated by Patrick Donnelly over 1 year ago

  • Status changed from New to Fix Under Review
  • Assignee changed from Dhairya Parmar to Neeraj Pratap Singh
  • Pull request ID set to 58898
Actions #7

Updated by Konstantin Shalygin over 1 year ago

  • Backport changed from quincy,reef,pacific to quincy,reef
Actions #8

Updated by Rishabh Dave over 1 year ago

  • Status changed from Fix Under Review to Pending Backport
  • Backport changed from quincy,reef to quincy,reef,squid
Actions #9

Updated by Upkeep Bot over 1 year ago

  • Copied to Backport #68708: squid: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT` added
Actions #10

Updated by Upkeep Bot over 1 year ago

  • Copied to Backport #68709: reef: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT` added
Actions #11

Updated by Upkeep Bot over 1 year ago

  • Copied to Backport #68710: quincy: common/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT` added
Actions #12

Updated by Upkeep Bot over 1 year ago

  • Tags (freeform) set to backport_processed
Actions #13

Updated by Upkeep Bot 9 months ago

  • Merge Commit set to adc6f2dbb507f13e473ab8b5551dedcc56791124
  • Fixed In set to v19.3.0-5756-gadc6f2dbb50
  • Upkeep Timestamp set to 2025-07-08T22:37:51+00:00
Actions #14

Updated by Upkeep Bot 8 months ago

  • Fixed In changed from v19.3.0-5756-gadc6f2dbb50 to v19.3.0-5756-gadc6f2dbb507
  • Upkeep Timestamp changed from 2025-07-08T22:37:51+00:00 to 2025-07-14T15:46:24+00:00
Actions #15

Updated by Upkeep Bot 8 months ago

  • Fixed In changed from v19.3.0-5756-gadc6f2dbb507 to v19.3.0-5756-gadc6f2dbb5
  • Upkeep Timestamp changed from 2025-07-14T15:46:24+00:00 to 2025-07-14T21:10:32+00:00
Actions #16

Updated by Upkeep Bot 5 months ago

  • Released In set to v20.2.0~1728
  • Upkeep Timestamp changed from 2025-07-14T21:10:32+00:00 to 2025-11-01T01:03:02+00:00
Actions

Also available in: Atom PDF