The Apple GPU and the Impossible Bug
https://rosenzweig.io/blog/asahi-gpu-part-5.html [rosenzweig.io]
2022-05-13 23:56
tags:
gl
graphics
hardware
investigation
mac
programming
In late 2020, Apple debuted the M1 with Apple’s GPU architecture, AGX, rumoured to be derived from Imagination’s PowerVR series. Since then, we’ve been reverse-engineering AGX and building open source graphics drivers. Last January, I rendered a triangle with my own code, but there has since been a heinous bug lurking: The driver fails to render large amounts of geometry.
source: HN
The Applesoft Compiler (TASC): We have the source code, in a sense
https://devblogs.microsoft.com/oldnewthing/20220419-00/?p=106496 [devblogs.microsoft.com]
2022-04-19 22:55
tags:
compiler
mac
programming
retro
Chaining was a common technique when your program got too large to fit into memory all at once, so you broke it into multiple programs that each handed off control to each other.
As the author added features, he kept hitting the Apple ][‘s 48KB RAM limit and was forced to delete all the comments from the code, and when that wasn’t enough, he resorted to shortening all the important variable names to one character.
Introduction to Apple Silicon
https://github.com/AsahiLinux/docs/wiki/Introduction-to-Apple-Silicon [github.com]
2022-03-17 03:23
tags:
bios
cpu
development
mac
systems
This document attempts to explain the Apple Silicon (i.e. M1 and later) Mac boot ecosystem (henceforth “AS Macs“), as it pertains for how open OSes interoperate with the platform.
It is intended for developers and maintainers of Linux, BSD and other OS distributions and boot-related components, as well as users interested in the platform, and its goal is to cover the overall picture without delving into excessive technical detail. Specifics should be left to other wiki pages. It also omits details that only pertain to macOS (such as how kernel extensions work and are loaded).
source: HN
Curious lack of sprintf scaling
https://aras-p.info/blog/2022/02/25/Curious-lack-of-sprintf-scaling/ [aras-p.info]
2022-02-25 22:08
tags:
c
concurrency
investigation
mac
perf
programming
Some days ago I noticed that on a Mac, doing snprintf calls from multiple threads shows curious lack of scaling (see tweet). Replacing snprintf with {fmt} library can speed up the OBJ exporter in Blender 3.2 by 3-4 times. This could have been the end of the story, filed under a “eh, sprintf is bad!” drawer, but I started to wonder why it shows this lack of scaling.
source: HN
This Man Thought Opening a TXT File Is Fine, He Thought Wrong. MacOS CVE-2019-8761
https://www.paulosyibelo.com/2021/04/this-man-thought-opening-txt-file-is.html [www.paulosyibelo.com]
2021-04-03 00:44
tags:
exploit
html
mac
security
text
turtles
This research originated when I realized the default text reader on OSX, TextEdit is used to open files with TXT extension by default. On the interface of TextEdit, it looked like you can do basic customization to your text (you can turn text bold, italic, change color etc...), so I was wondering how a TXT file was storing and parsing this information. It seems it uses RTF format instead of TXT if we add customizations to the text.
source: HN
The end of TenFourFox and what I've learned from it
http://tenfourfox.blogspot.com/2020/04/the-end-of-tenfourfox-and-what-ive.html [tenfourfox.blogspot.com]
2021-03-29 19:10
tags:
browser
development
javascript
mac
turtles
update
We’re running on fumes technologically as well. Besides various layout and DOM features we don’t support well like CSS grid, there are large JavaScript updates we’ll increasingly need which are formidably complex tasks. The biggest is async and await support which landed in Firefox 52, and which many sites now expect to run at all. However, at the time it required substantial changes to both JavaScript and the runtime environment and had lots of regressions and bugs to pick up. We have some minimal syntactic support for the feature but it covers only the simplest of use cases incompletely. There are also front end changes required to deal with certain minifiers (more about this in a moment) but they can all be traced back to a monstrous 2.5MB commit which is impossible to split up piecemeal. We could try to port 52ESR as a whole, but we would potentially suffer some significant regressions in the process, and because there is no Rust support for 32-bit PowerPC on OS X we couldn’t build anything past Firefox 54 anyway. All it does is just get us that much closer to an impenetrable dead end. It pains me to say so, but it’s just not worth it, especially if I, the browser’s only official beneficiary, am rarely using it personally these days. It’s best to hang it up here while the browser still works for most practical purposes and people can figure out their next move, rather than vainly struggling on with token changes until the core is totally useless.
source: HN
Counting cycles and instructions on the Apple M1 processor
https://lemire.me/blog/2021/03/24/counting-cycles-and-instructions-on-the-apple-m1-processor/ [lemire.me]
2021-03-25 02:12
tags:
cpu
mac
perf
programming
Recently, one of the readers of my blog (Duc Tri Nguyen) showed me how, inspired by code from Dougall Johnson. Dougall has been doing interesting research on Apple’s processors. As far as I can tell, it is entirely undocumented and could blow up your computer. Thankfully, to access the performance counters, you need administrative access (wheel group). In practice, it means that you could start your instrumented program in a shell using sudo so that your program has, itself, administrative privileges.
To illustrate the approach, I have posted a full C++ project which builds an instrumented benchmark. You need administrative access and an Apple M1 system. I assume you have installed the complete developer kit with command-line utilities provided by Apple.
source: HN
Dissecting the Apple M1 GPU
https://rosenzweig.io/blog/asahi-gpu-part-1.html [rosenzweig.io]
2021-01-22 18:59
tags:
graphics
hardware
investigation
mac
programming
series
systems
Apple’s latest line of Macs includes their in-house “M1” system-on-chip, featuring a custom GPU. This poses a problem for those of us in the Asahi Linux project who wish to run Linux on our devices, as this custom Apple GPU has neither public documentation nor open source drivers. Some speculate it might descend from PowerVR GPUs, as used in older iPhones, while others believe the GPU to be completely custom. But rumours and speculations are no fun when we can peek under the hood ourselves!
And part II where it really takes off: https://rosenzweig.io/blog/asahi-gpu-part-2.html
source: HN
Porting Firefox to Apple Silicon
https://hacks.mozilla.org/2021/01/porting-firefox-to-apple-silicon/ [hacks.mozilla.org]
2021-01-20 20:59
tags:
browser
development
mac
update
Even with all the pieces in place, quite a bit of work to do.
The release of Apple Silicon-based Macs at the end of last year generated a flurry of news coverage and some surprises at the machine’s performance. This post details some background information on the experience of porting Firefox to run natively on these CPUs.
We’ll start with some background on the Mac transition and give an overview of Firefox internals that needed to know about the new architecture, before moving on to the concept of Universal Binaries.
We’ll then explain how DRM/EME works on the new platform, talk about our experience with macOS Big Sur, and discuss various updater problems we had to deal with. We’ll conclude with the release and an overview of various other improvements that are in the pipeline.
source: HN
What went wrong with the libdispatch. A tale of caution for the future of concurrency.
https://tclementdev.com/posts/what_went_wrong_with_the_libdispatch.html [tclementdev.com]
2020-11-25 01:48
tags:
concurrency
development
library
mac
programming
The future was multithreading and we had to use the libdispatch to get there. So we did.
As we went down that rabbit hole, things got progressively worse.
source: L
CVE-2020–9934: Bypassing TCC
https://objective-see.com/blog/blog_0x4C.html [objective-see.com]
2020-07-30 16:50
tags:
auth
exploit
mac
security
The Transparency, Consent, and Control (TCC) Framework is an Apple subsystem which denies installed applications access to ‘sensitive’ user data without explicit permission from the user (generally in the form of a pop-up message)
source: L
Power Outage
https://tedium.co/2020/06/16/apple-powerpc-intel-transition-history/ [tedium.co]
2020-06-17 21:22
tags:
business
hardware
mac
retro
Perhaps the highly anticipated moment that I’m going to contextualize today is totally inevitable, in a way. For years, there’s been a rumbling that Apple would take its knowledge of the ARM processor architecture and bring it to its desktop and laptop computers. Next week, at a virtual Worldwide Developers Conference, the iPhone giant is expected to do just that. Of course, many will focus on the failed partner, the jilted lover of the business relationship that led to Apple’s move to vertically integrate: Intel. But I’m interested in the demise of the platform Intel vanquished on its way to taking over Apple—and the parallels that have emerged between PowerPC and Intel over time. Today’s Tedium dives into Apple’s long list of jilted processor partners, leaning closely on the shift from PowerPC to Intel. Keep Apple happy, or else.
Webcam Hacking
https://www.ryanpickren.com/webcam-hacking [www.ryanpickren.com]
2020-04-03 22:45
tags:
auth
browser
exploit
iphone
mac
security
turtles
web
The story of how I gained unauthorized Camera access on iOS and macOS
We are beginning to form the attack plan - if we can somehow trick Safari into thinking our evil website is in the “secure context” of a trusted website, we can leverage Safari’s camera permission to access the webcam via the mediaDevices API.
Aperture: Senior QA (2004-2005)
https://techreflect.net/2019/12/10/aperture-senior-qa-2004-2005/ [techreflect.net]
2020-02-18 02:38
tags:
development
mac
This project is tricky to write about as there was so much positive and negative emotion involved — a real roller coaster.
A good retrospective on a project that starts going sideways and then really jumps the rails.
source: DF
Information Leaks via Safari's Intelligent Tracking Prevention
https://arxiv.org/abs/2001.07421 [arxiv.org]
2020-01-23 00:46
tags:
browser
iphone
mac
opsec
pdf
security
web
Intelligent Tracking Prevention (ITP) is a privacy mechanism implemented by Apple’s Safari browser, released in October 2017. ITP aims to reduce the cross-site tracking of web users by limiting the capabilities of cookies and other website data. As part of a routine security review, the Information Security Engineering team at Google has identified multiple security and privacy issues in Safari’s ITP design. These issues have a number of unexpected consequences, including the disclosure of the user’s web browsing habits, allowing persistent cross-site tracking, and enabling cross-site information leaks (including cross-site search). This report is a modestly expanded version of our original vulnerability submission to Apple (WebKit bug #201319), providing additional context and edited for clarity. A number of the issues discussed here have been addressed in Safari 13.0.4 and iOS 13.3, released in December 2019.
source: green
All about the new ML Super Resolution feature in Pixelmator Pro
https://www.pixelmator.com/blog/2019/12/17/all-about-the-new-ml-super-resolution-feature-in-pixelmator-pro/ [www.pixelmator.com]
2019-12-19 02:18
tags:
ai
graphics
mac
photos
update
To create the ML Super Resolution feature, we used a convolutional neural network. This type of deep neural network reduces raster images and their complex inter-pixel dependencies into a form that is easier to process (i.e. requires less computation) without losing important features (edges, patterns, colors, textures, gradients, and so on). The ML Super Resolution network includes 29 convolutional layers which scan the image and create an over-100-channel-deep version of it that contains a range of identified features. This is then upscaled, post-processed and turned back into a raster image. Below is a simplified representation of the neural network.
Not quite all about it, and there’s better references for the technique, but neat to see this trickle down to entry level photo editing.
source: DF
So We Don'T Have A Solution For Catalina...Yet
https://www.codeweavers.com/about/blogs/jschmid/2019/9/10/so-we-dont-have-a-solution-for-catalinayet [www.codeweavers.com]
2019-12-11 03:02
tags:
compiler
development
mac
programming
virtualization
windows
With the release of macOS 10.15 (Catalina), Apple has dropped support for running 32-bit executables and removed the 32-bit versions of system frameworks and libraries. Most Windows applications our users run with CrossOver are 32-bit and CrossOver uses a 32-bit Mac executable, system frameworks, and libraries to run them. This will break with Catalina.
And then comes the fun part:
We have built a modified version of the standard C language compiler for macOS, Clang, to automate many of the changes we need to make to Wine’s behavior without pervasive changes to Wine’s source code.
First, our version of Clang understands both 32- and 64-bit pointers. We are able to control from a broad level down to a detailed level which pointers in Wine’s source code need to be 32-bit and which 64-bit. Any code which substitutes for Windows at the interface with the Windows app has to use 32-bit pointers. On the other hand, the interfaces to the system libraries are always 64-bit.
source: grugq
Dramatically reduced power usage in Firefox 70 on macOS with Core Animation
https://mozillagfx.wordpress.com/2019/10/22/dramatically-reduced-power-usage-in-firefox-70-on-macos-with-core-animation/ [mozillagfx.wordpress.com]
2019-10-23 06:27
tags:
browser
energy
gl
graphics
mac
perf
programming
update
In Firefox 70 we changed how pixels get to the screen on macOS. This allows us to do less work per frame when only small parts of the screen change. As a result, Firefox 70 drastically reduces the power usage during browsing.
Every Firefox window contains one OpenGL context, which covers the entire window. Firefox 69 was using the API described above. So we were always redrawing the whole window on every change, and the window manager was always copying our entire window to the screen on every change. This turned out to be a problem despite the fact that these draws were fully hardware accelerated.
Core Animation is the name of an Apple framework which lets you create a tree of layers (CALayer). These layers usually contain textures with some pixel content. The layer tree defines the positions, sizes, and order of the layers within the window. Starting with macOS 10.14, all windows use Core Animation by default, as a way to share their rendering with the window manager.
source: HN
Turning a MacBook into a Touchscreen Using the Webcam
https://www.anishathalye.com/2018/04/03/macbook-touchscreen/ [www.anishathalye.com]
2019-08-06 14:06
tags:
ai
graphics
hardware
mac
solder
ux
Our idea was to retrofit a small mirror in front of a MacBook’s built-in webcam, so that the webcam would be looking down at the computer screen at a sharp angle. The camera would be able to see fingers hovering over or touching the screen, and we’d be able to translate the video feed into touch events using computer vision.
source: HN
Memory Unsafety in Apple's Operating Systems
https://langui.sh/2019/07/23/apple-memory-safety/ [langui.sh]
2019-07-25 18:43
tags:
development
iphone
mac
security
Rather than just talking about a single release, what if we aggregated the total memory unsafety-related vulnerability statistics in Apple’s two flagship operating systems: iOS and macOS?
Across the entirety of iOS 12 Apple has fixed 261 CVEs, 173 of which were memory unsafety. That’s 66.3% of all vulnerabilities.
source: L