zhuizhuhaomeng Blog

「记录下来,一切都会更容易理解」

how does nginx http slice module work

我想分析一下 nginx_http_slice_module 的工作原理,因为自带的 OpenResty 不含该模块,因此需要自己编译。 在深入代码分析之前,我们需要先了解 HTTP bytes range 的请求 了解 HTTP bytes range 的原理 可以在点击 mozilla rnage request 查看详细的信息。 我们这里抽取一个请求响应的例子。 1 2 3 4 ...

Add gnu BuildID for Go program

我们可以使用 file 命令查看 ELF 文件的 BuildID。比如: 1 2 $ file /usr/bin/ls /usr/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l...

How to debug linux crash

总结 Linux 内核崩溃应该怎么调试呢?这篇文件挺好的,包含了分析的实例,https://wiki.whamcloud.com/display/LNet/Crash+course+on+Crash。 总结下来,关键的步骤就是: 要先配置 kdump 才能保存崩溃的现场。 需要安装 kernel-debuginfo 需要安装 crash 程序(当然也要 gdb) 使用...

Examples of Linux find command

1 2 3 4 5 6 7 #!/bin/bash for name in `find / -maxdepth 1 -type d -regex "/[0-9]+t-[a-z]"`; do for d in `find /16t-a/trace-pkg-db -maxdepth 2 -type d -regex ".*/\(rpms\|debs\)"`; do f...

An exmaple of ssl_certificate_by_lua

1. the lua code save the following code to file /usr/local/openresty/site/lualib/dynamic_cert.lua 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ...

HTTP error emulator

1. 模拟 HTTP 上游服务器不响应 (网关 504 超时) 以下 Go 程序作为源站 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 package main import ( ...

DWARF op code

elf 中 debug 相关的节 .debug_abbrev - Abbreviations used in the .debug_info section .debug_aranges - Lookup table for mapping addresses to compilation units .debug_frame - Call frame information...

systemctl examples

设置进程的调度属性 1 2 3 4 5 6 7 8 9 10 [Unit] Description=Machine Check Exception Logging Daemon [Service] ExecStart=/usr/sbin/mcelog --ignorenodev --daemon --foreground CPUSchedulingPolicy=fifo CPUSched...

gdb 读取 tls 变量

As answered in Using GDB to read MSRs, this is possible with gdb 8, using the registers $fs_base and $gs_base.

openssl 撤销证书

问题 lua-ngix-module 的测试用例中用到了撤销证书 t/cert/test.crl。在更新 t/cert/test.key 和 t/cert/test.crt 后忘记更新撤销证书列表导致用例失败。 那么如何生成撤销证书列表呢? 生成撤销证书列表 生成撤销证书列表需要用到 CA 证书,但是因为这里是自签名证书,因此就 CA 就算自签名证书本身。 下面的命令列表中给出了一些使...