Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System leaks in CreateEnvironmentBlock #757

Open
derekbruening opened this issue Nov 28, 2014 · 3 comments
Open

System leaks in CreateEnvironmentBlock #757

derekbruening opened this issue Nov 28, 2014 · 3 comments

Comments

@derekbruening
Copy link
Contributor

From rnk@google.com on January 19, 2012 12:38:12

Chromium has the following code in base::LaunchProcess for launching a process as another user:

if (!CreateEnvironmentBlock(&enviroment_block, options.as_user, FALSE))
  return false;

BOOL launched =
    CreateProcessAsUser(options.as_user, NULL,
                        const_cast<wchar_t*>(cmdline.c_str()),
                        NULL, NULL, options.inherit_handles, flags,
                        enviroment_block, NULL, &startup_info,
                        &process_info);
DestroyEnvironmentBlock(enviroment_block);

IMO it's pretty clear that environment_block is not leaked, yet we get these reports: http://build.chromium.org/p/chromium.fyi/builders/Windows&#37;20Tests&#37;20&#37;28DrMemory&#37;20full&#37;29/builds/514/steps/memory&#37;20test&#37;3A&#37;20base/logs/stdio Dr.M Error #4: LEAK 28 direct bytes 0x005aa1d0-0x005aa1ec + 840 indirect bytes
Dr.M # 0 RPCRT4.dll!? +0x0 (0x75f00636 <RPCRT4.dll+0x10636>)
Dr.M # 1 RPCRT4.dll!? +0x0 (0x75f00610 <RPCRT4.dll+0x10610>)
Dr.M # 2 RPCRT4.dll!I_RpcAllocate
Dr.M # 3 RPCRT4.dll!NDRCContextMarshall
Dr.M # 4 RPCRT4.dll!NDRCContextMarshall
Dr.M # 5 RPCRT4.dll!NDRCContextMarshall
Dr.M # 6 RPCRT4.dll!NdrClientInitialize
Dr.M # 7 RPCRT4.dll!? +0x0 (0x75fa015a <RPCRT4.dll+0xb015a>)
Dr.M # 8 SspiCli.dll!? +0x0 (0x75333478 <SspiCli.dll+0x23478>)
Dr.M # 9 SspiCli.dll!CredUnmarshalTargetInfo
Dr.M #10 SspiCli.dll!? +0x0 (0x75329b7a <SspiCli.dll+0x19b7a>)
Dr.M #11 SspiCli.dll!? +0x0 (0x75329d21 <SspiCli.dll+0x19d21>)
Dr.M #12 SspiCli.dll!? +0x0 (0x75329d71 <SspiCli.dll+0x19d71>)
Dr.M #13 SspiCli.dll!CredUnmarshalTargetInfo
Dr.M #14 SspiCli.dll!? +0x0 (0x7532a448 <SspiCli.dll+0x1a448>)
Dr.M #15 profapi.dll!? +0x0 (0x7502324f <profapi.dll+0x324f>)
Dr.M #16 profapi.dll!? +0x0 (0x750231e8 <profapi.dll+0x31e8>)
Dr.M #17 profapi.dll!? +0x0 (0x75022e40 <profapi.dll+0x2e40>)
Dr.M #18 profapi.dll!? +0x0 (0x7502225c <profapi.dll+0x225c>)
Dr.M #19 USERENV.dll!CreateEnvironmentBlock
Dr.M #20 base::LaunchProcess [base\process_util_win.cc:316]
Dr.M #21 ProcessUtilTest_LaunchAsUser_Test::TestBody [base\process_util_unittest.cc:418]
Dr.M #22 testing::internal::HandleExceptionsInMethodIfSupportedtesting::Test,void [testing\gtest\src\gtest.cc:2145]
Dr.M
Dr.M Error #5: LEAK 16 direct bytes 0x005b8a08-0x005b8a18 + 0 indirect bytes
Dr.M # 0 RPCRT4.dll!? +0x0 (0x75f00636 <RPCRT4.dll+0x10636>)
Dr.M # 1 RPCRT4.dll!? +0x0 (0x75f00610 <RPCRT4.dll+0x10610>)
Dr.M # 2 RPCRT4.dll!RpcBindingFree
Dr.M # 3 RPCRT4.dll!NdrConformantVaryingArrayBufferSize
Dr.M # 4 RPCRT4.dll!RpcBindingSetAuthInfoExW
Dr.M # 5 RPCRT4.dll!RpcBindingSetAuthInfoExW
Dr.M # 6 RPCRT4.dll!RpcBindingFree
Dr.M # 7 RPCRT4.dll!RpcBindingSetAuthInfoExW
Dr.M # 8 RPCRT4.dll!I_RpcBindingCopy
Dr.M # 9 RPCRT4.dll!NDRCContextMarshall
Dr.M #10 RPCRT4.dll!NDRCContextMarshall
Dr.M #11 RPCRT4.dll!NDRCContextMarshall
Dr.M #12 RPCRT4.dll!NdrClientInitialize
Dr.M #13 RPCRT4.dll!? +0x0 (0x75fa015a <RPCRT4.dll+0xb015a>)
Dr.M #14 SspiCli.dll!? +0x0 (0x75333478 <SspiCli.dll+0x23478>)
Dr.M #15 SspiCli.dll!CredUnmarshalTargetInfo
Dr.M #16 SspiCli.dll!? +0x0 (0x75329b7a <SspiCli.dll+0x19b7a>)
Dr.M #17 SspiCli.dll!? +0x0 (0x75329d21 <SspiCli.dll+0x19d21>)
Dr.M #18 SspiCli.dll!? +0x0 (0x75329d71 <SspiCli.dll+0x19d71>)
Dr.M #19 SspiCli.dll!CredUnmarshalTargetInfo
Dr.M #20 SspiCli.dll!? +0x0 (0x7532a448 <SspiCli.dll+0x1a448>)
Dr.M #21 profapi.dll!? +0x0 (0x7502324f <profapi.dll+0x324f>)
Dr.M #22 profapi.dll!? +0x0 (0x750231e8 <profapi.dll+0x31e8>)
Dr.M #23 profapi.dll!? +0x0 (0x75022e40 <profapi.dll+0x2e40>)
Dr.M #24 profapi.dll!? +0x0 (0x7502225c <profapi.dll+0x225c>)
Dr.M #25 USERENV.dll!CreateEnvironmentBlock
Dr.M #26 base::LaunchProcess [base\process_util_win.cc:316]
Dr.M #27 ProcessUtilTest_LaunchAsUser_Test::TestBody [base\process_util_unittest.cc:418]
Dr.M #28 testing::internal::HandleExceptionsInMethodIfSupportedtesting::Test,void [testing\gtest\src\gtest.cc:2145]
Dr.M
Dr.M Error #6: LEAK 2 direct bytes 0x005bd2f0-0x005bd2f2 + 0 indirect bytes
Dr.M # 0 RPCRT4.dll!? +0x0 (0x75f00636 <RPCRT4.dll+0x10636>)
Dr.M # 1 RPCRT4.dll!? +0x0 (0x75f00610 <RPCRT4.dll+0x10610>)
Dr.M # 2 RPCRT4.dll!RpcBindingFree +0x62a (0x75f0ae96 <RPCRT4.dll+0x1ae96>)
Dr.M # 3 RPCRT4.dll!NdrConformantVaryingArrayBufferSize +0x755 (0x75f10efe <RPCRT4.dll+0x20efe>)
Dr.M # 4 RPCRT4.dll!RpcBindingSetAuthInfoExW +0x620 (0x75f11cbe <RPCRT4.dll+0x21cbe>)
Dr.M # 5 RPCRT4.dll!RpcBindingSetAuthInfoExW +0x5b7 (0x75f11c55 <RPCRT4.dll+0x21c55>)
Dr.M # 6 RPCRT4.dll!RpcBindingFree +0xf0f (0x75f0b77b <RPCRT4.dll+0x1b77b>)
Dr.M # 7 RPCRT4.dll!RpcBindingSetAuthInfoExW +0x57f (0x75f11c1d <RPCRT4.dll+0x21c1d>)
Dr.M # 8 RPCRT4.dll!I_RpcBindingCopy +0x35 (0x75f0b98b <RPCRT4.dll+0x1b98b>)
Dr.M # 9 RPCRT4.dll!NDRCContextMarshall +0x21d (0x75f08314 <RPCRT4.dll+0x18314>)
Dr.M #10 RPCRT4.dll!NDRCContextMarshall +0x18b (0x75f08282 <RPCRT4.dll+0x18282>)
Dr.M #11 RPCRT4.dll!NDRCContextMarshall +0x150 (0x75f08247 <RPCRT4.dll+0x18247>)
Dr.M #12 RPCRT4.dll!NdrClientInitialize +0x124 (0x75f07116 <RPCRT4.dll+0x17116>)
Dr.M #13 RPCRT4.dll!? +0x0 (0x75fa015a <RPCRT4.dll+0xb015a>)
Dr.M #14 SspiCli.dll!? +0x0 (0x75333478 <SspiCli.dll+0x23478>)
Dr.M #15 SspiCli.dll!CredUnmarshalTargetInfo +0x156f (0x75324cb4 <SspiCli.dll+0x14cb4>)
Dr.M #16 SspiCli.dll!? +0x0 (0x75329b7a <SspiCli.dll+0x19b7a>)
Dr.M #17 SspiCli.dll!? +0x0 (0x75329d21 <SspiCli.dll+0x19d21>)
Dr.M #18 SspiCli.dll!? +0x0 (0x75329d71 <SspiCli.dll+0x19d71>)
Dr.M #19 SspiCli.dll!CredUnmarshalTargetInfo +0x288f (0x75325fd4 <SspiCli.dll+0x15fd4>)
Dr.M #20 SspiCli.dll!? +0x0 (0x7532a448 <SspiCli.dll+0x1a448>)
Dr.M #21 profapi.dll!? +0x0 (0x7502324f <profapi.dll+0x324f>)
Dr.M #22 profapi.dll!? ...

Original issue: http://code.google.com/p/drmemory/issues/detail?id=757

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on February 01, 2012 08:33:20

is this a dup of issue #476 ?

@derekbruening
Copy link
Contributor Author

From rnk@google.com on March 21, 2012 06:43:07

IIRC we discussed that this isn't a dup, the stacks here are pretty different despite both having userenv.dll!CreateEnvironmentBlock in them.

This popped up again on the bot: http://build.chromium.org/p/client.drmemory/builders/win-7_x64-drm/builds/2011 Our existing suppression isn't good enough because by default we only go 11 frames deep. Without tracing further, I don't see a way to suppress this precisely. I also generally expect that 11 frames is not enough for most users. Can we increase the default to 15 or more?

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on March 21, 2012 07:50:19

if you add enough performance optimizations for 15 frames to have zero perf impact on spec2k6 apps like tonto and perlbench

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

No branches or pull requests

1 participant