<div dir="ltr">Hi Steven,<div><br></div><div>Great to see the commentary and updates here. I've got a few questions about some of this work. It might be nice to see some separate RFCs for a couple of things, but we'll figure that out after you send out patches probably :)</div><div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>What needs to be improved:<br>1. Whitelist for command line options that can be used with bitcode:<br>Current trunk implementation embeds all the cc1 command line options (that includes header include paths, warning flags and other front-end options) in the command line section. That is lot of redundant information. To re-create the object file from the embedded optimized bitcode, most of these options are useless. On the other hand, they can leak information of the source code. One solution will be keeping a list of all the options that can affect code generation but not encoded in the bitcode. I have internally prototyped with disallowing these options explicitly and allowed only the reminder of the options to be embedded (<a href="http://reviews.llvm.org/D17394" target="_blank">http://reviews.llvm.org/D17394</a>). A better solution might be encoding that information in "Options.td" as specific group.<br></div></div></blockquote><div><br></div><div>This is really interesting. I'm not a particularly security minded person so I don't have a lot of commentary there. An explicit whitelist sounds a bit painful to keep maintained, explicitly having a group in Options.td sounds pretty nice. You'll need to add them to multiple groups, but it seems pretty nice.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>2. Assembly input handling:<br>This is a workaround to allow source code written in assembly to work with "-fembed-bitcode" options. When compiling assembly source code with "-fembed-bitcode", clang-as creates an empty section "__LLVM, __asm" in the object file. That is just a way to distinguish object files compiled from assembly source from those compiled from higher level source code but forgot to use "-fembed-bitcode" options. Linker can use this section to diagnose if "-fembed-bitcode" is consistently used on all the object files participated in the linking.<br></div></div></blockquote><div><br></div><div><span style="line-height:1.5">I'm surprised you want a separate and empty section and not a header flag as those are easier to keep around and won't take up a precious mach-o section. There are probably other options here as well. There are probably other options or concerns that someone shipping bitcode might have here as well, but I'm sure those are being talked about - doesn't have too much affect on the community though.</span></div><div><span style="line-height:1.5"><br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>3. Bitcode symbol hiding:<br>There was some concerns for leaking source code information when using bitcode feature. One approach to avoid the leak is to add a pass which renames all the globals and metadata strings. The also keeps a reverse map in case the original name needs to be recovered. The final bitcode should contain no more symbols or debug info than a stripped binary. To make sure modified bitcode can still be linked correctly, the renaming need to be consistent across all bitcode participated in the linking and everything that is external of the linkage unit need to be preserved. This means the pass can only be run during the linking and requires some LTO api.<br></div></div></blockquote><div><br></div><div>How are you planning to ensure the safety of the reverse map? Seems that requiring linking is a bit icky, but might work. Are you mostly worried about function names that could be stripped out? What LTO api are you envisioning here? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>4. Debug info strip to line-tables pass:<br>As the name suggested, this pass strip down the full debug info to line-tables only. This is also one of the steps we took to prevent the leak of source code information in bitcode.<br></div></div></blockquote><div><br></div><div>I'm very curious about what's going on here. Could you elaborate? :)</div><div><br></div><div>Thanks a ton for the update - glad to see this being worked on!</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br>Please let me know what do you think about the pieces above or if you have any concerns about the methodology. I will put up patches for review soon.<br><br>Thanks<br><br>Steven</div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div></div>