Skip to content

Instantly share code, notes, and snippets.

View kaityo256's full-sized avatar
🤖
I, Robot

Hiroshi Watanabe kaityo256

🤖
I, Robot
  • Keio University
  • Japan
View GitHub Profile
@kaityo256
kaityo256 / test.cpp
Created February 22, 2019 23:23
Undefined Behavior Sample
#include <iostream>
int foo() {
std::cout << "foo" << std::endl;
}
void bar() {
std::cout << "bar" << std::endl;
foo();
}
@kaityo256
kaityo256 / test.cpp
Created February 22, 2019 10:21
Infinite Loop on Mac GCC
#include <iostream>
int foo(int m) {
std::cout << 1 << std::endl;
std::cout << 2 << std::endl;
}
void bar() {
foo(0);
}
@kaityo256
kaityo256 / test.cpp
Created February 22, 2019 10:03
SIGILL on MAC again
int hoge() {
}
int main() {
hoge();
}
@kaityo256
kaityo256 / collatz.cpp
Created January 25, 2019 01:43
demons fly out of your nose
// Modified from https://qiita.com/tkmtSo/items/de3148dd1dcb70f38d6a
#include <cstdio>
int collatz(int n) {
while (true) {
if (n == 1)
return 1;
if (n % 2 == 0) {
n /= 2;
} else {
n = 3 * n + 1;
@kaityo256
kaityo256 / ub3.c
Created November 26, 2018 06:00
SIGILL on MAC and g++
int func(int a){
}
int func2(int a){
return func(a);
}
int main(){
func2(1);
}
@kaityo256
kaityo256 / ub.c
Created November 26, 2018 03:52
ubsan sample
double func(double a) {}
int main() {
func(1.0);
}
@kaityo256
kaityo256 / test.cpp
Created November 26, 2018 03:18
SIGILL on Mac OS X (Mojave) and GCC 8.2.0
#include <iostream>
#include <string>
double func(std::string &str) {
}
int main() {
std::string str = "test";
func(str);
}
@kaityo256
kaityo256 / x86info.txt
Created November 18, 2018 09:47
x86info -c on Intel(R) Xeon(R) CPU E5-2680
$ ./x86info -c
x86info v1.31pre
Found 24 identical CPUs
Extended Family: 0 Extended Model: 3 Family: 6 Model: 63 Stepping: 2
Type: 0 (Original OEM)
CPU Model (x86info's best guess): Core i7-5820K [Haswell-X]
Processor name string (BIOS programmed): Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
Cache info
L1 Data Cache: 32KB, 8-way associative, 64 byte line size
@kaityo256
kaityo256 / x86info.txt
Created November 17, 2018 12:58
x86info -c on Intel(R) Xeon(R) Gold 6130
x86info v1.31pre
Found 32 identical CPUs
Extended Family: 0 Extended Model: 5 Family: 6 Model: 85 Stepping: 4
Type: 0 (Original OEM)
CPU Model (x86info's best guess): Core i7 (Skylake-X)
Processor name string (BIOS programmed): Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
Cache info
L1 Data Cache: 32KB, 8-way associative, 64 byte line size
L1 Instruction Cache: 32KB, 8-way associative, 64 byte line size
@kaityo256
kaityo256 / x86info.txt
Created November 17, 2018 12:23
x86info -c on AMD EPYC 7281
$ ./x86info -c
x86info v1.31pre
Found 32 identical CPUs
Extended Family: 8 Extended Model: 0 Family: 15 Model: 1 Stepping: 2
CPU Model (x86info's best guess): Unknown CPU 0x800f12
Processor name string (BIOS programmed): AMD EPYC 7281 16-Core Processor
Monitor/Mwait: min/max line size 64/64, ecx bit 0 support, enumeration extension
SVM: revision 1, 32768 ASIDs, np, lbrVirt, SVMLock, NRIPSave, TscRateMsr, VmcbClean, FlushByAsid, DecodeAssists, PauseFilter, PauseFilterThreshold
Address Size: 48 bits virtual, 48 bits physical