Actions
Bug #67169
opencommon/strtol: fix `strict_iec_cast` which parses inputs like `TG` or `GT`
Status:
Pending Backport
Priority:
Normal
Assignee:
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
Merge Commit:
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
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@
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`
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
Updated by Patrick Donnelly over 1 year ago
- Has duplicate Bug #67226: ceph.quota.max_bytes accepting Invalid values added
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
Updated by Konstantin Shalygin over 1 year ago
- Backport changed from quincy,reef,pacific to quincy,reef
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
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
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
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
Updated by Upkeep Bot over 1 year ago
- Tags (freeform) set to backport_processed
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
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
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
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