Skip to content

Instantly share code, notes, and snippets.

View iAklis's full-sized avatar
🎯
Focusing on Cloud Security

Aklis iAklis

🎯
Focusing on Cloud Security
View GitHub Profile
@kconner
kconner / macOS Internals.md
Last active July 7, 2024 19:42
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@0x36
0x36 / oob_events.c
Created November 5, 2020 23:16
IOAccelContext2::finish_fence_event() race condition OOB read/write
#if 0
IOAccelContext2::finish_fence_event() race condition OOB read/write
This is a method exposed to user space, it takes a kernel read-only shared memory
(type 2 via clientMemoryForType()) address and treats it as an IOAccelEvents Array.
The user supplied index is checked against the IOAccelEvents array bounds,since there are no
locks held in this method,it is possible to change the array bounds by calling
IOAccelContext2::clientMemoryForType() again in a separate thread, this will expand the size by
multiplying the older size by 2, but we still have a reference to the old shared memory address
@cb372
cb372 / riscv.md
Last active July 12, 2024 16:49
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@anatol
anatol / qemucheatsheet
Created December 30, 2018 02:52
Install Arch in QEMU and run KTSAN
https://medium.com/@clem.boin/creating-a-minimal-kernel-development-setup-using-qemu-and-archlinux-987896954d84
# Install Arch system
qemu-image -f qcow2 kernel-dev-archlinux.img 4G
wget http://mirrors.edge.kernel.org/archlinux/iso/2018.12.01/archlinux-2018.12.01-x86_64.iso
# Note that ping does not work here
qemu-system-x86_64 -cdrom archlinux-2018.12.01-x86_64.iso -boot order=d -drive file=kernel-dev-archlinux.img,format=qcow2 -m 2G -enable-kvm -cpu host -smp 8 -net user,hostfwd=tcp::10022-:22 -net nic
@jackyyf
jackyyf / wireguard.if-post-down
Created July 30, 2018 11:40
ifupdown helper for wireguard
#!/bin/bash -e
#
# wireguard helper script
#
IP=/sbin/ip
if [ "$IF_WG_CONF" -o "$IF_WG_PRIVATE_KEY" ]
then
$IP link del $IFACE
@extremecoders-re
extremecoders-re / qemu-networking.md
Last active July 8, 2024 13:24
Setting up Qemu with a tap interface

Setting up Qemu with a tap interface

There are two parts to networking within QEMU:

  • The virtual network device that is provided to the guest (e.g. a PCI network card).
  • The network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).

Example: User mode network

@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active July 1, 2024 21:55
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@tonyseek
tonyseek / android-captive.sh
Last active July 4, 2024 05:27
Overrides the captive portal settings of Android in the People's Republic China mainland
#!/usr/bin/env sh
## I don't have any devices running Android OS now. These settings may have been outdated but I cannot verify it.
adb shell settings put global captive_portal_fallback_url http://g.cn/generate_204
adb shell settings put global captive_portal_http_url http://www.google.cn/generate_204
adb shell settings put global captive_portal_https_url https://www.google.cn/generate_204
adb shell settings put global captive_portal_other_fallback_urls http://www.qualcomm.cn/generate_204
@arfon
arfon / big_query_examples.md
Last active September 19, 2022 13:00
BigQuery Examples for blog post

How many times shouldn't it happen...

-- https://news.ycombinator.com/item?id=11396045

SELECT count(*)
FROM (SELECT id, repo_name, path
        FROM [bigquery-public-data:github_repos.sample_files]
 ) AS F
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class