Skip to content

crimson/osd: add embedded suppression ruleset for LSan - #50598

Merged
rzarzynski merged 1 commit into
ceph:mainfrom
rzarzynski:wip-crimson-only-tcmalloc-lsan-supp
May 23, 2023
Merged

rzarzynski merged 1 commit into
ceph:mainfrom
rzarzynski:wip-crimson-only-tcmalloc-lsan-supp

Conversation

@rzarzynski

Copy link
Copy Markdown
Contributor

This commit, basing the idea from the Chromium browser, embdeds the suppression rules directly into the crimson executable. The benefit is simplicity and no need to modify the teuthology code to ship a file across all involved nodes like already happens for valgrind.supp.

From teuthology/task/install/util.py:

def _ship_utilities(ctx):
    """
    Write a copy of valgrind.supp to each of the remote sites.  Set executables
    used by Ceph in /usr/local/bin.  When finished (upon exit of the teuthology
    run), remove these files.

    :param ctx: Context
    """
    testdir = teuthology.get_testdir(ctx)
    filenames = []

    log.info('Shipping valgrind.supp...')
    assert 'suite_path' in ctx.config
    try:
        with open(
            os.path.join(ctx.config['suite_path'], 'valgrind.supp'),
            'rb'
                ) as f:
            fn = os.path.join(testdir, 'valgrind.supp')
            filenames.append(fn)
            for rem in ctx.cluster.remotes.keys():
                teuthology.sudo_write_file(
                    remote=rem,
                    path=fn,
                    data=f,
                    )
                f.seek(0)
    except IOError as e:
        log.info('Cannot ship supression file for valgrind: %s...', e.strerror)

With these suppressions --mkfs with crimson, BlueStore and tcmalloc starts returning the proper exit code:

[rzarzynski@o06 build]$ /home/rzarzynski/ceph1/build/bin/crimson-osd -i 0 -c /home/rzarzynski/ceph1/build/ceph.conf --mkfs --key AQCZsRBkM5CPIBAACmCbEiP3DPh+x9iiaRDZmA== --osd-uuid c3d4aea0-02de-459b-ad00-fe943906a9a8 --cpuset 0-0
...
created object store /home/rzarzynski/ceph1/build/dev/osd0 for osd.0 fsid 8c9aa852-1ba2-4800-9695-e0be4bf877dc
-----------------------------------------------------
Suppressions used:
  count      bytes template
      1          8 InitModule
-----------------------------------------------------
[rzarzynski@o06 build]$ echo $?
0

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

This commit, basing the idea from the Chromium browser,
embdeds the suppression rules directly into the crimson
executable. The benefit is simplicity and no need to modify
the teuthology code to ship a file across all involved nodes
like already happens for `valgrind.supp`.

From `teuthology/task/install/util.py`:

```
def _ship_utilities(ctx):
    """
    Write a copy of valgrind.supp to each of the remote sites.  Set executables
    used by Ceph in /usr/local/bin.  When finished (upon exit of the teuthology
    run), remove these files.

    :param ctx: Context
    """
    testdir = teuthology.get_testdir(ctx)
    filenames = []

    log.info('Shipping valgrind.supp...')
    assert 'suite_path' in ctx.config
    try:
        with open(
            os.path.join(ctx.config['suite_path'], 'valgrind.supp'),
            'rb'
                ) as f:
            fn = os.path.join(testdir, 'valgrind.supp')
            filenames.append(fn)
            for rem in ctx.cluster.remotes.keys():
                teuthology.sudo_write_file(
                    remote=rem,
                    path=fn,
                    data=f,
                    )
                f.seek(0)
    except IOError as e:
        log.info('Cannot ship supression file for valgrind: %s...', e.strerror)
```

With these suppressions `--mkfs` with crimson, BlueStore and tcmalloc
starts returning the proper exit code:

```
[rzarzynski@o06 build]$ /home/rzarzynski/ceph1/build/bin/crimson-osd -i 0 -c /home/rzarzynski/ceph1/build/ceph.conf --mkfs --key AQCZsRBkM5CPIBAACmCbEiP3DPh+x9iiaRDZmA== --osd-uuid c3d4aea0-02de-459b-ad00-fe943906a9a8 --cpuset 0-0
...
created object store /home/rzarzynski/ceph1/build/dev/osd0 for osd.0 fsid 8c9aa852-1ba2-4800-9695-e0be4bf877dc
-----------------------------------------------------
Suppressions used:
  count      bytes template
      1          8 InitModule
-----------------------------------------------------
[rzarzynski@o06 build]$ echo $?
0
```

Signed-off-by: Radoslaw Zarzynski <[email protected]>
@Matan-B

Matan-B commented Mar 21, 2023 •

Copy link
Copy Markdown
Contributor

LGTM.
Do we know if #46062 passes with this PR? Might be worth unifying both of them into a single PR.

I would also suggest re-basing before testing again since the suite and some of the source have been changed recently.

Moreover, this PR fixes rados_api_tests for the first time.
The test was failing due to:

==105563==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f4f6d004730 at pc 0x7f4f964b2107 bp 0x7f4f6d0046f0 sp 0x7f4f6d003e98
WRITE of size 24 at 0x7f4f6d004730 thread T0
    #0 0x7f4f964b2106 in __interceptor_sigaltstack.part.0 (/lib64/libasan.so.6+0x54106)
    #1 0x7f4f965185b3 in __asan::PlatformUnpoisonStacks() (/lib64/libasan.so.6+0xba5b3)
    #2 0x7f4f9651e14c in __asan_handle_no_return (/lib64/libasan.so.6+0xc014c)

@rzarzynski, Are we sure we want to suppress it as well? IIUC, this one seems like an actual error.
Attaching the full traceback [2].

[1] http://qa-proxy.ceph.com/teuthology/sjust-2023-02-14_21:48:25-crimson-rados-wip-sjust-57801-distro-default-smithi/7174672/remote/smithi042/log/ceph-osd.0.log.gz

[2] https://gist.github.com/Matan-B/928a8147907a417b3756afbecc13f386

@rzarzynski

rzarzynski commented Mar 22, 2023 •

Copy link
Copy Markdown
Contributor Author

Do we know if #46062 passes with this PR? Might be worth unifying both of them into a single PR.

Yes, we know – the run mentioned above had these two commits inside.

Are we sure we want to suppress it as well?

I don't think we're suppressing it. If so, LSan should inform it happened. Do you see something like below?

-----------------------------------------------------
Suppressions used:
  count      bytes template
      1          8 InitModule
-----------------------------------------------------

I guess bigger change in the test run was the TC enablement and this might have hidden the buffer overflow. However, I'm not sure it's a good reason to block this change.

@rzarzynski

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B Matan-B left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we're suppressing it. If so, LSan should inform it happened. Do you see something like below?\

Yes, the same "Suppressions used" appears [1].

I guess bigger change in the test run was the TC enablement and this might have hidden the buffer overflow. However, I'm not sure it's a good reason to block this change.

I just wanted to make sure we are not coarsely suppressing actual leaks - which seems that it's not the case here since the test passed because of TC usage.
I'm also ok with merging this.

[1] https://pulpito.ceph.com/rzarzynski-2023-03-19_22:30:59-crimson-rados-wip-crimson-only-tcmalloc-distro-crimson-smithi/7213778/

@markhpc markhpc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, though I haven't looked closely at the specific issues Matan mentioned so I'll leave that for you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants