In which Wowfunhappy and krackers talk about stuff #51
Replies: 9 comments 112 replies
-
Yes, you should just be able to use the same dyld_interpose technique on the mangled c++ name? Recall that when c++ is compiled down to code the fully qualified symbol (including namespace and type information) is mangled into a single identifier. As a result c++ code that does not have its symbols stripped can sometimes be easier to disassemble than c code because type information remains. And C and C++ are interoperable by definition. So just treat the entire mangled c++ symbol name as you would the C symbol and use that when interposing. With C++ you also have another interesting technique at your disposable which is vtable hijacking |
Beta Was this translation helpful? Give feedback.
-
Huh, I thought of using Next time I have a reason to try it, I'll ask you, and maybe you can tell me what I screwed up. 🙂 |
Beta Was this translation helpful? Give feedback.
-
@Wowfunhappy just realized (after trying for dozens of minutes to try to inject into an app that was complaining about missing This means that if the app crashes before it's recognized by the system as finished "launch" then you'll never be able to simbl inject. In that case dyld inject would be preferable. |
Beta Was this translation helpful? Give feedback.
-
MacportsLegacySupport is the best. The developer of imitone, an app I purchased years ago and haven't used much since, recently broke support for macOS 10.11 and below. He's been trying to add it back in and asked for testers. I offered because I like it when apps maintain support for old OS X, and actually I'd like to experiment with imitone again. His test builds didn't work, but I was quickly able to see the problem: the app was expecting _clock_gettime to be in libSystem.B.dylib. So I copied
Followed by a quick I told the developer all of this and even sent him a copy of the modified app. We'll see if he's okay getting an explanation from a random stranger. 🤷♂️ Of course, he probably shouldn't use this hacky method for the real release. He could presumably link |
Beta Was this translation helpful? Give feedback.
-
@Wowfunhappy Question: have you ever noticed this issue where the stack icon for chrome downloads is blank? I recently cleaned up my dock to make use of the stack, and I'm seeing this issue but I don't know if it's just something with my setup or if the referenced bug still exists. |
Beta Was this translation helpful? Give feedback.
-
@krackers So since you just helped me fix one of my biggest long-time frustrations with my OS X setup... any interest in helping with another one? 🙂 I am unduly upset that dragging an .app bundle out of the I want to stop Finder from creating aliases. I'm convinced it's something hardcoded in Finder, but I've never been able to figure out what is responsible... |
Beta Was this translation helpful? Give feedback.
-
I want to stop Finder from creating aliases..... @Wowfunhappy .....Put in the trash then move it where you want it..... |
Beta Was this translation helpful? Give feedback.
-
@Wowfunhappy Random question: do you happen to have Intel Power Gadget installed? Seems like all versions that work with 10.9 have been pulled, and I can't find any open source equivalent on github at the moment (basically needs a kext that polls the right CSR, but I'd rather have the official one if possible) |
Beta Was this translation helpful? Give feedback.
-
Since we're talking about CoreText, thought I'd dump some other notes here. 10.9 doesn't just have CoreText crashes, apparently it also contains a (rather servere) performance issue that Harfbuzz can trigger with the coretext AAT backend. Now of course as seen in harfbuzz/harfbuzz@ba4b7be as of v2.0 harfbuzz has implemented its own support for Apple AAT and it (and Chrome) no longer relies on coretext for much, but the underlying codepaths still actually exist if you use the harfbuzz coretext shaper backend directly. -- First some discussion of apple AAT fonts, since I didn't know much about typography. As seen in https://fontforge.org/docs/techref/gposgsub.html AAT fonts contain additional sections on glyph kerning, substitutions, and shaping data. I think OpenType does support many of the same things, but for whatever reason apple's fork of TrueType uses these non-standard sections instead. There's some detailed discussion by expert typographers that goes over my head in https://typedrawers.com/discussion/758/aat-in-decline-who-develops-aat-features. Also https://www.opticentre.net/FAQ/Fonts/OpenType-font/
Which apple themselves states in their whitepaper: https://web.archive.org/web/20090617063720/http://developer.apple.com/textfonts/WhitePapers/IUC15CG.pdf
Practically, the effect of AAT fonts can be easily seen with Zapfino on mac (https://thatkeith.com/articles/zapfino-the-typeface-with-built-in-magic/), but even system fonts such as Helvetica rely on the AAT kerning sections (morx) as opposed to OpenType ones (GPOS?) for things like kerning numbers or slight baseline adjustment. (There are probably opentype versions of Zapfino and Helvetica though, so I'm not sure if there's anything practical that AAT can do that OpenType currently doesn't... maybe AAT font variations [dynamic width/height], which seem to only recently have an opentype equivalent) With that background on AAT out of the way, there's a curious bug that persisted for about a year, all the way through until support for mavericks was officially discontinued (since 68 was the last to officially run on mavericks, while the harfbuzz AAT replacement happened at 72 or something): if you load pages with a lot of CJK text that have a "complex" layout, rendering can take on the order of 10 seconds, and fontd will have heavy CPU usage. Bisecting I found a "good" chrome version is 53.0.2767.6 and the issue was introduced somehwere around "54.0.2803.7" What happened in between these versions? Well the chrome bug tracker and harfbuzz source give us the full story, and it is in fact related to the emoji crashes that I originally started this GH thread with. We start with https://issues.chromium.org/issues/40441917 which mentions a commit r355800 (https://chromium.googlesource.com/chromium/src/+/9f6a2b03ccb7091804f173b70b5facff7dffbd61) which I don't quite understand but apparently causes shaping to be invoked a lot more than it used to be. In particular it seems to invoke the shaper once per specified font (e.g. in CSS if you specify 3 different possible fonts it will try to shape with each). CoreText also has its own font fallback logic though, so the two seem to interact poorly, resulting in quadratic behavior. If you list 5 different fonts, but none except the last exist, you can make on the order of 5^2 calls into coretext. Now the rub is that CoreText shaper is only invoked for AAT fonts anyway, and AAT shaping takes extra long. If you disable coretext shaping using the obscure The clever chromium folks tried to fix the issue and avoid the quadratic behavior by telling CoreText not to try any fallback fonts. So far so good, and if you try a build with this fix in things work as expected. But on 10.9 apparently things are not so good: disabling the fallback/cascade logic ends up causing crashes for certain symbols. https://issues.chromium.org/issues/40475517. So they decided to keep this fallback logic for 10.9, which brings back the performance issue for these platforms. And I guess the cherry is that there's another issue where not disabling the cascade reconfiguration logic causes crashes on certain emoji which is the issue I created this discussion about. TL;DR coretext on 10.9(+?) is quite cursed, no wonder they wanted add a native AAT backend in harfbuzz just to avoid using it. Also that you should ideally try avoid too many fallback fonts when making pages, e.g. it's strictly more performant to have a separate class for japanese text (using japanese font) and english text, rather than having one selector with fallback. |
Beta Was this translation helpful? Give feedback.
-
Continued from: #44 (comment)
Once I got a modern macOS VM set up bluebox's scripts pretty much just worked. Builds take a long time though, I basically can only do them overnight. Which is why I haven't done more with the code base. (Granted, I'm doing this in a Big Sur VM running on top of Mavericks running on a 4790K, it's no slouch but it's far from the fastest hardware available in 2022.)
I have written SIMBL plugins (GreenFullscreen), but it depends on what I'm doing and it's kind of an "aesthetic" decision. I don't want the Chromium Downloader Preference Pane to require users to install SIMBL, for example.
For non-Chromium stuff...
So yeah, there's probably more I'm forgetting, but I often have a reason to not use SIMBL.
I assume they figure that everyone on 10.11+ is "protected" by SIP anyway.
Actually, while I have you—I'm able to very easily replace Objective-C methods via ZKSwizzle, and I'm able to replace C functions via DYLD_INTERPOSE, but do you know if there's a similarly-easy way to replace C++ methods? (I have a feeling there's not.)
Objective-C swizzling is really fun, it makes it so damn easy to tell apps to just do whatever I want. 😈
Edit: It occurred to me that the conversation title is a bit exclusionary. Please feel free to join in regardless of your internet handle. 🙂
Beta Was this translation helpful? Give feedback.
All reactions