ALL POSTS

Posts · Page 4

Try to find the redundant area with the Python gdb (riscv)

Try to find the redundant area with the Python gdb (riscv) 大概想統計出某個區域內的pc address所使用的 register 的使用次數與alias的register,和記錄所有regiser 在某個區域內的所有regiser的 狀態,先假設相同compiler來說在編譯加了某些option 導致某段code做不好…

Systems, OS & Compilers
Try to find the redundant area with the Python gdb (riscv)

Install Bugzilla

Bugzilla 來學習一下安裝Bugzilla ,參考 https://cloudinfrastructureservices.co.uk/how-to-install-bugzilla-bug-tracker-on-ubuntu-server-20-04-tutorial/ 最近剛透過 VirtualBox 裝 Ubuntu 23.04 ,參考下面網址來達到背景模式執行 h…

DevOps & Cloud
Install Bugzilla

q learning maze

q learning python3 Copy import numpy as np import random import os import time # 定義迷宮地圖 maze = np . array ([ [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ], [ 0 , 1 , 0 , 1 , 1 , 1 , 0 , 0 ], [ 0 , 0 , 0…

AI & Data
q learning maze

觀察gcc rtl合成

在gcc 可以下 code Copy -fdump-rtl-all-all 得到gcc 執行rtl pass的優化結果,其中目前我的平台是 x86 那唯一看到rtl tree有真正執行 並且變化的 pass有三個 code Copy combine reload cprop_hardreg 這是在pass中所呈現的rtl tree code Copy (insn 31 30 3…

Systems, OS & Compilers
觀察gcc rtl合成

trace gdb source code

trace gdb 最近在看能不能在gdb攔截一些有關於runtime的程式的pc address ,gdb背後底層原理是ptrace,大概從各個檔案裏面去埋print(printf_unfiltered (("hello\n"));),來稍微紀錄一下 arch arch 資料夾存放的是有關於指令架構的一些function也就是當觸發斷點時候可以透過不同的arch將不同的reg…

Systems, OS & Compilers
trace gdb source code

Pytorch 傾向性分析

傾向性分析 JOSPON-with-Pytorch 在這個github中他提供的範例,可以直接顯示評價是接近於正面還是負面 流程大概如下 先處理wiki data,準備製作w2v模型 使用檔案:w2v_seg.py 使用處理好的wiki data訓練w2v模型 使用檔案:w2v_train.py 取得waimai資料集句向量,製作waimai_10k_tw.pkl 使用檔案:m…

AI & DataProgramming & Software Engineering
Pytorch 傾向性分析

Pytorch stock lstm

lstm python Copy import torch import torch.nn as nn import numpy as np import torch.optim as optim import strategy.popular_model as popmoder import os import matplotlib.pyplot as plt from sk…

AI & Data
Pytorch stock lstm

python chatgpt

chatgpt 目前收費最貴的是 https://openai.com/api/pricing/ davinci,openai已經封裝好了 https://dev.to/codemee/yong-python-chuan-jie-openai-mo-ni-chatgpt-liao-tian-ji-qi-ren-2fh6 python Copy import os import…

AI & Data
python chatgpt

refactor prev version stock

無聊重構以前的回測軟體 之前的預言家模型每次anaconda更換環境都會出問題,在策略格式每個都不太一樣這次順便全部依國外網站的格式讓所有策略都兼容 https://github.com/WillKoehrsen/Data-Analysis/blob/master/stocker/Stocker%20Prediction%20Usage.ipynb 這邊不用以前的fbprob…

Finance & Blockchain
refactor prev version stock

linux hook record

linux hook 之前有分享 linux hook的方式,包括ld_preload,目前有個情況需要額外override 原本的某個function在linux 環境,這邊記錄一下可行方案 lief https://github.com/lief-project/LIEF code Copy pip install lief 如果採用直接修改elf 是否有可能直接hook…

Systems, OS & Compilers
linux hook record

rewrite llvm pass inline/unroll loop pass

custom llvm pass inline / unrol loop pass 最近有空更新一下,如果要異動llvm 內部的pass應該從哪裡下手呢 Writing an LLVM Pass — LLVM 16.0.0git documentation 這邊可以大概看到一些架構,不過我們要在llvm10達成pass的修改,根據我們的需求任意的對某個fucntion 進行in…

Systems, OS & Compilers
rewrite llvm pass inline/unroll loop pass

pwn double free&use after free

double free & use-after-free https://bbs.pediy.com/thread-266757.htm 前天在寫llvm pass又重新看到的angr 想起以前看到有人寫 https://xz.aliyun.com/t/7275 double free & use-after-free漏洞挖掘,他這種寫法可能導致z3求解狀態過多 https:…

Security & Reverse Engineering
pwn double free&use after free

custom gcc plugin rtl unroll loop ,inline pass

gcc plugin 補足之前,影響fucntion 是否inline 版本,額外新增了可以影響unroll loop rtl層 pass的撰寫,這邊一併附上 這次比較特別趕上了chatgtp,rtl pass 這部分語法都是透過chatgpt幫助下進行撰寫,基本上不當機的情況下都快變成google 2.0了,包括這個文章都是用chatgpt產生,但是要注意除非你是領域上的專家…

Systems, OS & Compilers
custom gcc plugin rtl unroll loop ,inline pass