Skip to content

Instantly share code, notes, and snippets.

View thestinger's full-sized avatar

Daniel Micay thestinger

View GitHub Profile
$ ps -ZA | grep hal_
u:r:hal_bootctl_default:s0 root 493 1 13120 2548 binder_wait_for_work 0 S android.hardware.boot@1.0-service
u:r:hal_keymaster_default:s0 system 494 1 14804 3324 binder_wait_for_work 0 S android.hardware.keymaster@3.0-service
u:r:hal_graphics_composer_default:s0 system 500 1 32228 7324 binder_wait_for_work 0 S android.hardware.graphics.composer@2.1-service
u:r:hal_configstore_default:s0 system 521 1 16032 2400 binder_wait_for_work 0 S android.hardware.configstore@1.0-service
u:r:hal_graphics_allocator_default:s0 system 522 1 14488 2964 binder_wait_for_work 0 S android.hardware.graphics.allocator@2.0-service
u:r:hal_allocator_default:s0 system 620 1 11876 2384 binder_wait_for_work 0 S android.hidl.allocator@1.0-service
u:r:hal_audio_default:s0 audioserver
// clang -std=c99 -O2 foo.c && ./a.out
#include <stdio.h>
#include <stdbool.h>
__attribute__((noinline)) void foo(bool b) {
if (b) return; // remove this line and it will exit without printing
for (;;) {}
}
// clang -std=c99 -O2 foo.c && ./a.out
//
// Should infinite loop but prints "reached!" and exits.
//
// It removes the call to foo as a no-op.
//
// C11 allows removing no-op infinite loops, but not if their control condition
// is constant. Using `while (1)` or `for (; 1;)` instead of `for (;;)` has the
// same issue though.
@thestinger
thestinger / 0_attestation.txt
Last active February 1, 2018 20:06
Sample Pixel 2 key attestation chain
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: ecdsa-with-SHA256
Issuer: serialNumber = c6047571d8f0d17c
Validity
Not Before: Feb 1 18:50:25 2018 GMT
Not After : Feb 7 06:28:15 2106 GMT
Subject: CN = Android Keystore Key
normal:
02-05 01:12:12.045 26426 26611 D AttestationService: encoded length: 642, compressed length: 592
02-05 01:12:12.045 26426 26611 D AttestationService: encoded length: 559, compressed length: 522
CXF dictionary:
02-04 20:05:55.322 19372 19564 D AttestationService: encoded length: 641, compressed length: 575
02-04 20:05:55.323 19372 19564 D AttestationService: encoded length: 559, compressed length: 489
Modules using the Blueprint build system:
oreo-mr1-release/external/fec/Android.bp: misc_undefined: ["integer"],
oreo-mr1-release/external/fec/Android.bp: misc_undefined: ["integer"],
oreo-mr1-release/external/libvpx/libwebm/Android.bp: cfi: true,
oreo-mr1-release/external/libvpx/libwebm/Android.bp: cfi: true,
oreo-mr1-release/external/libvpx/Android.bp: cfi: true,
oreo-mr1-release/external/libvpx/Android.bp: cfi: true,
oreo-mr1-release/external/libvpx/Android.bp: blacklist: "cfi_blacklist.txt",
oreo-mr1-release/external/flac/libFLAC/Android.bp: cfi: true,
#!/usr/bin/env python
#
# Instrument vmlinux STP, LDP and BLR instructions to protect RA and restrict jumpping
#
# Depends on:
# 1) a modified gcc that
# - outputs 2 nop's before stp x29, x30 instructions
# - outputs 1 nop after ldp x29, x30 instructions
# 2) a kernel built using gcc command-line options to prevent allocation of registers x16, x17, and x18
#
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
My new Twitter account is @DanielMicay. As of 2018-07-28, there are no other
Twitter accounts associated with myself or the hardened mobile OS formerly
known as CopperheadOS. My previous Twitter account was hijacked and is now
controlled by Copperhead. The only other developer to have done any work on
the OS quit their job at Copperhead after I was pushed out of the company and
they were primarily focused on other projects during their time there.
-----BEGIN PGP SIGNATURE-----
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
static const unsigned size_classes[] = {
/* large */ 4 * 1024 * 1024,
/* 0 */ 0,
/* 16 */ 16, 32, 48, 64, 80, 96, 112, 128,
/* 32 */ 160, 192, 224, 256,
/* 64 */ 320, 384, 448, 512,
#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <limits.h>
#include <sys/mman.h>
int print_maps(void) {
FILE *fp = fopen("/proc/self/maps", "r");