Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

itrofimow (Ivan)
User

Projects

User does not belong to any projects.

User Details

User Since
Jun 16 2022, 6:51 PM (75 w, 4 d)

Recent Activity

Oct 11 2023

itrofimow abandoned D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.

Closing this in favor of github PR: https://github.com/llvm/llvm-project/pull/65534

Oct 11 2023, 7:38 AM · Restricted Project, Restricted Project, Restricted Project

Aug 31 2023

itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • rebase to trigger build
Aug 31 2023, 3:50 AM · Restricted Project, Restricted Project, Restricted Project

Aug 30 2023

itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • wip on making the build green
Aug 30 2023, 6:39 AM · Restricted Project, Restricted Project, Restricted Project
itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • + clang-format
  • cleanup
  • + clang-format, fix libcxx.imp
  • wip on making the build green
  • wip on making the build green
  • regenerate ignore_format.txt
  • bits of formatting
  • wip on making the build green
Aug 30 2023, 4:45 AM · Restricted Project, Restricted Project, Restricted Project
itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • regenerate ignore_format.txt
Aug 30 2023, 1:52 AM · Restricted Project, Restricted Project, Restricted Project

Aug 29 2023

itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • wip on making the build green
Aug 29 2023, 9:26 AM · Restricted Project, Restricted Project, Restricted Project
itrofimow updated the diff for D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi.
  • wip on making the build green
Aug 29 2023, 4:38 AM · Restricted Project, Restricted Project, Restricted Project

Aug 24 2023

itrofimow published D158620: [libcxx] [libcxxabi] don't throw+catch in std::make_exception_ptr when building with libcxxabi for review.

Inspired by what libstdc++ does: we don't have to throw + catch (thus unwinding) an exception when creating exception_ptr,
because libcxxabi knows exactly how to create an exception_ptr from the given object.

Aug 24 2023, 4:05 AM · Restricted Project, Restricted Project, Restricted Project

Apr 13 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

I can confirm that this patch (with parentheses added around comparison in ReadContextStack)
applied atop of clang-15.0.7 fixes https://github.com/userver-framework/userver/issues/170

Apr 13 2023, 10:45 AM · Restricted Project, Restricted Project
itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Hi @vitalybuka! Thank you for getting back to this.

Apr 13 2023, 8:02 AM · Restricted Project, Restricted Project

Mar 27 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Hi @vitalybuka ! Pinging you about this

Mar 27 2023, 10:05 AM · Restricted Project, Restricted Project

Mar 1 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Hi @vitalybuka! Did you have a chance to look into makecontext issue?

Mar 1 2023, 7:17 AM · Restricted Project, Restricted Project

Feb 3 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Actually, what's the state of this patch? It feels to me that there are 3 competing possibilities of what to do with the swapcontext issue:

  1. Land this, see how it goes and what/where it breaks, if any
  2. Completely abandon all cleanup machinery and make it users responsibility, as @vitalybuka suggested
  3. Revert https://reviews.llvm.org/D129219 together with https://reviews.llvm.org/D130218

So I would prefer no.1, likely some cases would need some user side workaround like no.2
Do you see issues with the current state of the patch? If not, I can land it.
Would you prefer if I submit the patch into your name, as it was started by you? If you don't want to accept the blame for this version, I can land with my name.

Feb 3 2023, 2:56 AM · Restricted Project, Restricted Project

Jan 31 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Hi!
Is there anything i can do to help resolving the issue (https://github.com/llvm/llvm-project/issues/58633), be that this patch or reverting some other patches?
Right now i'm a bit confused as what to do with this and how to advance any further.

Jan 31 2023, 11:56 AM · Restricted Project, Restricted Project

Jan 7 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

since it breaks ucp cleanup after swapcontext returns in some cases.

Can you elaborate a bit what is "ucp cleanup" and how it breaks?

Sure.
Say we have two contexts, A and B, and we swapcontext from A to B, do some work on Bs stack and then swapcontext back from B to A.
At this point shadow memory of Bs stack is in arbitrary state, but since we can't know whether B will ever swapcontext-ed to again we clean up it's shadow memory,
because otherwise it remains poisoned and blows in completely unrelated places when heap-allocated memory of Bs context gets reused later (see https://github.com/llvm/llvm-project/issues/58633 for example).
swapcontext prototype is swapcontext(ucontext* oucp, ucontext* ucp), so in this example A is oucp and B is ucp, and i refer to the process of cleaning up Bs shadow memory as ucp cleanup.

About how it breaks:
Take the same example with A and B: when we swapcontext back from B to A the oucp parameter of swapcontext is actually B, and current trunk resets its stack in a way that it becomes "uncleanupable" later.
It works fine if we do A->B->A, but if we do A->B->A->B->A no cleanup is performed for Bs stack after after B "returns" to A second time.
That's exactly what happens in the test i provided, and it's actually a pretty common real world scenario.

Hope this clarifies things at least a bit.

Thanks! You may fold the description into the commit message/Differential summary and perhaps add a brief comment (including A->B->A->B->A) to the test function Poll.

Jan 7 2023, 7:16 PM · Restricted Project, Restricted Project
itrofimow updated the summary of D137654: [runtimes][asan] Fix swapcontext interception.
Jan 7 2023, 7:06 PM · Restricted Project, Restricted Project

Jan 6 2023

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

since it breaks ucp cleanup after swapcontext returns in some cases.

Can you elaborate a bit what is "ucp cleanup" and how it breaks?

Jan 6 2023, 4:31 AM · Restricted Project, Restricted Project

Dec 1 2022

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

@vitalybuka gently pinging you on this. Can you see this ever landing or am i going the wrong direction with the idea of using ss_flags?

Dec 1 2022, 7:45 AM · Restricted Project, Restricted Project

Nov 16 2022

itrofimow updated the diff for D137654: [runtimes][asan] Fix swapcontext interception.
  • more exhaustive check for flags
Nov 16 2022, 7:30 AM · Restricted Project, Restricted Project

Nov 14 2022

itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Using flags is to easy to find example when it fails.

Nov 14 2022, 4:41 PM · Restricted Project, Restricted Project
itrofimow added a comment to D137654: [runtimes][asan] Fix swapcontext interception.

Hi @vitalybuka!
Did you have a chance to make yourself familiar with my reasoning?

Nov 14 2022, 1:20 PM · Restricted Project, Restricted Project

Nov 11 2022

itrofimow updated the diff for D137654: [runtimes][asan] Fix swapcontext interception.
  • cr fixes
Nov 11 2022, 2:44 PM · Restricted Project, Restricted Project

Nov 10 2022

itrofimow added inline comments to D137654: [runtimes][asan] Fix swapcontext interception.
Nov 10 2022, 11:55 AM · Restricted Project, Restricted Project
itrofimow added inline comments to D137654: [runtimes][asan] Fix swapcontext interception.
Nov 10 2022, 11:51 AM · Restricted Project, Restricted Project
itrofimow added reviewers for D137654: [runtimes][asan] Fix swapcontext interception: vitalybuka, eugenis.

Hi! Could you please have a look at this?

Nov 10 2022, 8:23 AM · Restricted Project, Restricted Project

Nov 8 2022

itrofimow requested review of D137654: [runtimes][asan] Fix swapcontext interception.
Nov 8 2022, 9:43 AM · Restricted Project, Restricted Project

Jul 21 2022

itrofimow added a comment to D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

rebase

Jul 21 2022, 8:38 AM · Restricted Project, Restricted Project

Jul 11 2022

itrofimow added a comment to D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

I guess some sanity check would be good, but since we get are not guessing this value but getting it directly from the OS, it's fine either way?

In boost::Coroutine2 stack size might be user-provided and i am not sure if there is a limitation at all.

Could you please add a test?

Sure, but could you please suggest an appropriate place for that and where to look for references? - i'm not familiar with the codebase

Take a look at:
compiler-rt/test/asan/TestCases/Linux/swapcontext_test.cpp
compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cpp

You may consider to modify them, or just fork and throw away unneeded stuff.
I expect new test is just simplest piece of code which use this function and fails without patch and passes with the patch.

Jul 11 2022, 5:05 AM · Restricted Project, Restricted Project

Jul 10 2022

itrofimow updated the diff for D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

+ clang-format

Jul 10 2022, 7:16 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

now checking the test with a patch

Jul 10 2022, 6:45 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

making sure this test breaks on trunk

Jul 10 2022, 5:58 PM · Restricted Project, Restricted Project

Jul 6 2022

itrofimow added a comment to D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

I guess some sanity check would be good, but since we get are not guessing this value but getting it directly from the OS, it's fine either way?

Jul 6 2022, 11:10 AM · Restricted Project, Restricted Project
itrofimow added a comment to D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.

Based on https://github.com/google/sanitizers/issues/1494

Jul 6 2022, 10:21 AM · Restricted Project, Restricted Project
itrofimow requested review of D129219: [libasan] Remove 4Mb stack limit for swapcontext unpoisoning.
Jul 6 2022, 10:18 AM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

rebase on main

Jul 6 2022, 4:45 AM · Restricted Project, Restricted Project

Jul 5 2022

itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

cr fixes

Jul 5 2022, 8:35 PM · Restricted Project, Restricted Project

Jul 3 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

binary size after changes: https://pastebin.com/raw/z23mLN93

 text	   data	    bss	    dec	    hex	filename
10323	    744	      8	  11075	   2b43	binary_size_main
10996	    744	      8	  11748	   2de4	binary_size_patch

Thanks! I like these numbers better! This about half of the size overhead of the previous version.
I assume the main values have changed due to rebasing, right?

Jul 3 2022, 5:10 AM · Restricted Project, Restricted Project
itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

binary size after changes: https://pastebin.com/raw/z23mLN93

Jul 3 2022, 4:28 AM · Restricted Project, Restricted Project

Jul 2 2022

itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

Trying to force a rebuild

Jul 2 2022, 1:09 PM · Restricted Project, Restricted Project

Jun 30 2022

itrofimow added inline comments to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 30 2022, 6:52 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

review fixes, updated benchmarks (https://pastebin.com/raw/AF0fa9VJ)

Jun 30 2022, 6:33 PM · Restricted Project, Restricted Project

Jun 28 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

I had a look at the code and I wonder whether a different approach might be better. Instead of adding a template argument we change __rehash to two function __rehash_unique and __rehash_multi. This seems the approach already taken for other functions in the __hash_table class.

This means the public functions rehash and resize also need two versions. The other functions calling rehash are already specific for unique and multi. I think we can keep the unique key argument on these rehash functions. So I would suggest something along the lines of.

// These were rehash, keep them public and adjust the callers
_LIBCPP_INLINE_VISIBILITY void __rehash_unique(size_type __n) { __rehash<true>(__n); }
_LIBCPP_INLINE_VISIBILITY void __rehash_multi(size_type __n) { __rehash<false>(__n); }

// These were reserve, keep them public and adjust the callers
_LIBCPP_INLINE_VISIBILITY void __reserve_unique(size_type __n)
      {__rehash_unique(static_cast<size_type>(ceil(__n / max_load_factor())));}                                              
_LIBCPP_INLINE_VISIBILITY void __reserve_multi(size_type __n)
      {__rehash_multi(static_cast<size_type>(ceil(__n / max_load_factor())));}


// rename __rehash to __do_rehash and make it templated
template<class _UniqueKeys>
void __do_rehash(size_type __n);

// rename rehash to __rehash, make it private and make it templated
template<class _UniqueKeys>
void __rehash(size_type __n);

Then we can keep the templated rehashing you added but only have the template arguments on these two function instead of the entire class.

WDYT?

Jun 28 2022, 8:23 AM · Restricted Project, Restricted Project

Jun 27 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

Gently pinging this

Jun 27 2022, 9:48 AM · Restricted Project, Restricted Project

Jun 23 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

Would this example be enough?
I could've messed up compile flags, and guidance would be appreciated if i did so

Thanks! Can you provide the output of the size command instead of the ls command for both binaries?

Jun 23 2022, 3:51 AM · Restricted Project, Restricted Project

Jun 22 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

One request, when you address a review comment, can you check the "done" button this makes reviewing easier.

I had a look at the changes and I'm wondering about the impact on the size of the binary. You add one template argument to "only" adjust the __rehash function. This means the __hash_table for unordered_map<K, V> and unordered_multimap<K, V> will be different after this change. Could you provide some numbers regarding how much the binary will grow when an applications uses both unordered_map<K, V> and unordered_multimap<K, V>`?

Jun 22 2022, 7:04 PM · Restricted Project, Restricted Project
itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

So i got some benchmarks: unordered_set_benches

Jun 22 2022, 5:10 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

code review fixes

Jun 22 2022, 4:45 PM · Restricted Project, Restricted Project

Jun 19 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

Thank you guys for the valuable feedback. I'll get back to this near the end of the upcoming week

Jun 19 2022, 10:05 AM · Restricted Project, Restricted Project

Jun 17 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

Can some please help me with clang-format builds failing?
This is what i used to update the patch arc diff HEAD~ --update D128021 --nolint, but format build are still failing.
What should i do to fix that?

Jun 17 2022, 6:13 PM · Restricted Project, Restricted Project
itrofimow added inline comments to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 17 2022, 5:59 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

cleanup, + benchmarks

Jun 17 2022, 5:44 PM · Restricted Project, Restricted Project

Jun 16 2022

itrofimow added a comment to D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

I recommend against clang-format everywhere here. When uploading the patch, you can specify --nolint to arc so it won't complain about the lack of clang-formatting a particular changeset. The noise ratio compared with the actual content change here is high in my opinion.

Jun 16 2022, 9:59 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 16 2022, 9:57 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 16 2022, 8:59 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 16 2022, 8:13 PM · Restricted Project, Restricted Project
itrofimow updated the diff for D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.

+ clang-format

Jun 16 2022, 7:43 PM · Restricted Project, Restricted Project
itrofimow requested review of D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine.
Jun 16 2022, 7:24 PM · Restricted Project, Restricted Project