QuickJs 剖析
Value 表示
在动态语言的VM中,由于通常变量的值都不是静态类型的,都是可变的,另一方面动态类型的值一般涉及到Gc的设计实现,因此不能直接使用特定类型来直接表示值,而一般抽象出一层Value来统一表示所有的值,即这个Value有可能为null,有可能为undefined,有可能为number,那么就需要将不同值来编码到另一个通用表示,简单来说是一个映射关系。通常的编码方式包括Tagged Value和Nan Boxing,Tagged Value跟union类似,我们在不知道值的情况下,可以加个tag解决,读取值时,先读取tag,再根据tag拿到对应的有意义的值,这种方法很简单,但是需要多一个字长来存储tag,通常64位对齐的情况下,就需要64位来存储tag,这样很浪费内存,当然也...
CSAPP BUFLAB
Level 0 Candle
首先在反汇编代码中找到smoke函数的地址为0x08048b04,接着在反汇编代码中找到getbuf函数,发现其缓冲区大小为0x28即40个字节,则构造48个字节输入,最后四个字节使用smoke函数地址覆盖原返回地址即可。
Level 1 Sparkler
首先在反汇编代码中找到fizz函数的地址为0x08048b2e,发现其调用参数地址为0x8(%ebp),则只需构造56个字节,其中最后四个字节使用cookie值覆盖,第45至48字节使用fizz函数地址覆盖即可。
Level 2 Firecracker
首先在反汇编代码中找到bang函数的地址为0x08048b82,并发现global_value的地址为0x804e10c或者0x804e104...
SSL/TLS Introduction
作用
HTTPS 建立于SSL/TLS之上,用于保证通信数据的加密
握手过程
Client Hello
客户端发送,包含random1以及客户端支持的加密套件1组合等信息
Server Hello
服务端发送,包含后续使用的加密套件及random2
Certificate
服务器发送,包含证书信息
Certificate Verify
客户端使用内置CA公钥解密证书指纹信息及指纹算法,验证通过后,发送PreMaster Key2,
同时客户端与服务端生成会话密钥
Change Cipher Spec
客户端/服务端发送,通知后...
CSAPP DATALAB
Report For Puzzles
Bit Manipulations
bitAnd:
Similar to $A \cap B=-(-A \cup -B)$, $\sim (\sim x \lvert \sim y)=x\&y$
getByte:
To extract byte n from x, first shift x to the right by $n«3$, thus making the wanted byte reside in the last byte in x. Then x & 0xff is the wanted byte.
logicalShift:
...
How does BN help optimzation
Batch Normalization
popular belief:
controlling the change of the layers’ input distributions during training to reduce the so-called “internal covariate shift”
truth:
makes the optimization landscape significantly smoother, inducing a more predictive and stable behavior of the gradients, allowing for faster training....
Travis CI Tutorial
Continuous Integration
The practice of merging in small code changes frequently
The goal is to build healthier software by developing and testing in smaller increments.
Travis-CI
supports your development process by automatically building and testing code changes, providing immediate feedback on the success of the change.
automate ...
How to build nginx
First, download the source code
wget http://nginx.org/download/nginx-1.9.9.tar.gz
Attention:here, you can choose the version of nginx according to your need
Then, unzip the file
tar -zxvf nginx-1.9.9.tar.gz
You wil find a new dir named “nginx-1.9.9” in your current dir
Then, compile and install
cd nginx-1.9.9 #change current dir
# configur...