Skip to content

mds/Server: replace ceph_assert for uid/gid with log prints#54121

Closed
mihalicyn wants to merge 1 commit intoceph:mainfrom
mihalicyn:server_fix_uid_gid_assert_check
Closed

mds/Server: replace ceph_assert for uid/gid with log prints#54121
mihalicyn wants to merge 1 commit intoceph:mainfrom
mihalicyn:server_fix_uid_gid_assert_check

Conversation

@mihalicyn
Copy link
Contributor

@mihalicyn mihalicyn commented Oct 20, 2023

Having ceph_assert calls is unsafe in the Server::prepare_new_inode when assertion depends on a data which is a client-provided. A malicious client can easily crash MDS by purpose.

Let's replace two ceph_assert calls for owner_{u,g}id's with log prints.

See also:
#54108

Fixes: commit 46cb244 ("ceph_fs.h: add separate owner_{u,g}id fields")
Fixes: https://tracker.ceph.com/issues/62217

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

Having ceph_assert calls is unsafe in the Server::prepare_new_inode
when assertion depends on a data which is a client-provided.
A malicious client can easily crash MDS by purpose.

Let's replace two ceph_assert calls for owner_{u,g}id's with
log prints.

See also:
ceph#54108

Fixes: commit 46cb244 ("ceph_fs.h: add separate owner_{u,g}id fields")
Fixes: https://tracker.ceph.com/issues/62217

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
@github-actions github-actions bot added the cephfs Ceph File System label Oct 20, 2023
@mihalicyn
Copy link
Contributor Author

jenkins test make check

@mihalicyn
Copy link
Contributor Author

cc @vshankar @lxbsz

@mihalicyn
Copy link
Contributor Author

jenkins test make check

@mihalicyn
Copy link
Contributor Author

jenkins test make check arm64

if (_inode->gid == (unsigned)-1 || _inode->uid == (unsigned)-1) {
dout(0) << "WARNING: client specified uid " << _inode->uid << " gid " << _inode->gid << " for ino " << _inode->ino << dendl;
mds->clog->error() << mdr->client_request->get_source()
<< " specified uid " << _inode->uid << " gid " << _inode->gid << " for ino " << _inode->ino;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could generate incredible amount of spam. Is this really an error or can we replace it with a reasonable default?

Copy link
Contributor Author

@mihalicyn mihalicyn Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error and if we have uid/gid equal to -1 it means that something is terribly wrong with the client. Ideally, we need to fail the request somehow. Xiubo (@lxbsz) what do you think about this?

See also #54149

@mihalicyn
Copy link
Contributor Author

See also #54149

@vshankar
Copy link
Contributor

@mihalicyn Do we need this change now since that actual crash is not fixed?

@mihalicyn
Copy link
Contributor Author

Hi, Venky!

Hm, we have fixed the actual crash everywhere, so I guess we can drop this change. As you say.

@vshankar vshankar closed this Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants