TASK_threadsp的实现及asm-offsets.h
主动调度与上下文切换
主动调度与上下文切换
CentOS Linux release 7.5.1804 CoreLinux centosgpt 5.2.0-rc4 1 SMP Sun Jun 16 13:25:49 CST 2019 x86_64 x86_64 x86_64 GNU/Linux
Given a string containing just the characters ‘’, ‘’, ‘{’, ‘}’, ’’ and ‘’, determine if the input string is valid
实时进程的调度策略:
这篇文章 Scaling Appsec at Netflix 是出自 Netflix Technology Blog Netflix的 应用安全团队的主要服务对象是在云基础架构上发布应用的工程团队, Netflix安全主张:安全是每个产品团队的责任 Netflix安全团队工作主要分为三类: 应用安全运营功能:传统的AppSec活动: BUG赏金分类,测试, 威胁建模,漏洞管理,产品安全。 安全合作伙伴关系:推动整体安全改进降低风险。 应用安全自动化:构建全面的应用程序库并启动自助安全指导。 运营Appsec功能由于存在高度中断,非持续性,过去的几个月,团队进行了重组,分为自动化和合作伙伴小组两个团队。 APPsec自动化队目标是提供 一致,可操作, 自我服务,为开发提供指导。通过Spinnaker 的平台,为开发人员提供单一的视图提供相关操作, 确保应用安全。 安全工作从过去的使用一些传动的DevSecOps方法如:静态代码扫描,动态测试,反模式grep, 转变为使用自动化方式提供自助服务。 合作伙伴小组更关注于与具有高风险的工程和产品团队(例如支付工程)密切合作, 目标是确定安全风险领域, 专注于更大的战略举措从而降低风险。 团队的最终目标是退出运营职责,将工作重点放到自动化和合作伙伴两种工作模式上。
概述: 项目变更版本需要源码包, 检查关键代码是否缺失,其中有一个步骤需要进入指定目录解压所有.ZIP压缩包 问题: 1. 并行处理; 2. zipfile extract后中文名称乱码; 解决: 并行处理使用 ,参考之前的扫描端口的套路修改; zipfile 解压乱码,踏着前人的足迹,查看了下python zipfile 源码open 函数中 如果zinfo.flag_bits 不是utf-8 都默认设为cp437 1 2 3 4 5 6 7 8 def open(self, name, mode="r", pwd=None, *, force_zip64=False): ... if zinfo.flag_bits & 0x800: # UTF-8 filename fname_str = fname.decode("utf-8") else: fname_str = fname.decode("cp437") ... ZIP File Format Specification 中描述 1 2 3 4 5 6 7 8 9 APPENDIX D - Language Encoding (EFS) ------------------------------------ D.1 The ZIP format has historically supported only the original IBM PC character encoding set, commonly referred to as IBM Code Page 437. This limits storing file name characters to only those within the original MS-DOS range of values and does not properly support file names in other character encodings, or languages. To address this limitation, this specification will support the following change. 代码: 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 46 47 48 49 50 51 52 53 import os import zipfile from queue import Queue import time import threading from pathlib import Path print_lock = threading.Lock() def unzip(file): file_name, ext = os.path.splitext(file) if ext == ".zip": try: f = zipfile.ZipFile(file, 'r') for fn in f.namelist(): extract_path = Path(f.extract(fn)) extract_path.replace(fn.encode('cp437').decode('gbk')) with print_lock: print(file, 'unzip ok') except: with print_lock: print(file, 'unzip error') pass def threader(): while True: worker = q.get() unzip(worker) q.task_done() def create_thread( threadnums ): for x in range(threadnums): t = threading.Thread(target=threader) t.daemon = True t.start() if __name__ == "__main__": q = Queue() startTime = time.time() path = os.getcwd()+'\\源码' os.chdir(path) file_list = os.listdir(path) print(file_list) create_thread(100) for unzipfile in file_list: q.put(unzipfile) q.join() print('Time taken:', time.time()-startTime) 参考: python zipfile extract 解压 中文文件名 ...
题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. getMin() – Retrieve the minimum element in the stack. Example: 1 2 3 4 5 6 7 8 MinStack minStack = new MinStack(); minStack.push(-2); minStack.push(0); minStack.push(-3); minStack.getMin(); --> Returns -3. minStack.pop(); minStack.top(); --> Returns 0. minStack.getMin(); --> Returns -2. 解题: 与普通栈不同,增加了一个返回栈最小值的功能, 这里使用了两个栈, 一个保存数据 , 一个保存压栈过程中出现过的最小值。 ...
这篇文章CFI directives in assembly file (18 Jan 2017), 是出自google 工程师Adam Langley 问题提出: 函数调用栈 1 2 3 4 5 6 7 8 : : | caller's stack | +----------------+ <----$rsp value before CALL | return address | +----------------+ <----$rsp at function entry | caller's rbp | +----------------+ <----$rbp always points here | callee's stack | 函数调用中 调用call指令时将call指令的下一条指令 return address 入栈, 其中return address存放在RIP寄存器中也就是将 RIP入栈,之后进入子函数后会将父函数的栈基地址入栈,其中父函数的栈基地保存在RBP寄存器中。 函数栈调用框架: push rbp mov rbp, rsp ...
本篇主要通过反汇编与GDB两种方式分析函数栈的使用过程。
pid: 进程ID - tid:线程ID - tgid:主线程ID