看nt下无驱执行ring0代码

WinDBG从Ring3到Ring0跟踪CreateFileW的执行流程 本次跟踪的系统版本: 调试机(宿主机):WIN7 64位旗舰版 目标机(虚拟机):WIN7 32位旗舰版 1、在虚拟机里打开一个记事本,然后Ctrl+Break中断操作系统 2、在WinDBG中输入!process 0 0 notepad.exe查看记事本进程信息 3、在WinDBG中输入.process /i /p 进程内核对象地址,在本例中则应该输入.pr 阅读详情

X86平台上,cpu可以工作在三个特权级别下,ring0—ring3,其中ring0具有最高权限,可以执行任何指令而无限制,ring3受到cpu保护机制限制,只能执行非特权指令。当在ring3下执行特权指令如lgdt、iret等时,会触发general protection异常(也就是出错啦,跳转到相应得错误处理程序)。

在nt平台下,普通应用程序运行在ring3下,操作系统运行于ring0。如果在程序中需要执行一些特权指令的话,程序必须转入到ring0。由于用户程序执行特权指令可能会破坏系统资源,故出于保护和稳定的目的,操作系统通过“门”机制向用户态程序提供必要的服务。在x86种有四种门:中断门、陷阱门、调用门、任务门。

先描述一下门的概念,个人认为就是两种不同状态之间的通道,换句话说,也就是不同环(特权级)之间切换的通道。

一般在操作系统初始化时,由real mode进入保护模式(pmode)后,cpu就处于ring0状态,在完成各种初始化后,系统转入用户态并创建用户进程。用户程序需要特权服务时,通过系统调用进入ring0,由系统完成指定的、在提供的服务范围内的请求。这样可以避免恶意程序破坏系统。但是如果我们想执行一些“特殊的”操作时怎么办?

这个问题有几个解决方法,第一种方法是安装驱动;驱动程序作为内核的辅助模块为用户程序提供服务,它与操作系统一样工作在ring0,而且他是可以根据自己需编写。所以可以通过编写一个“自定义的”驱动程序来执行ring0代码,这种方法在nt下和linux下应该都可,(不好意思,本人没实践过,忙着“好好学习”,有时间再说)。第二种限定于nt平台,通过“自定义门”来实现执行ring0代码。

由于nt平台的特性,导致用户可以通过操作Section对象//device/PhysicalMemory来操作物理内存。这样就可通过找到全局描述符表GDT或中断描述符表IDT并修改其内容来构造自己的“门”,甚至使用自定义代码来覆盖内核代码,。。。通过这些方法来达到执行ring0代码的目的。说得有点混乱…下面将一些预备知识,以便为后面理解作基础….

WinRing0相关源代码,及已编译好的dll动态库,支持Win32和x64平台下获取CPU温度获取及cpuid相关操作 压缩包中为WinRing0相关源代码,及已编译好的dll动态库,支持Win32和x64平台下获取CPU温度获取及cpuid相关操作。 立即下载

相关推荐

易语言无驱动进入ring0

易语言无驱动进入ring0源码系统结构:读取cr0,操作数据,写物理内存,读物理内存,查看字节集,提升进程权限,查看字节集2,到十六进制文本,RtlAdjustPrivilege,NtSystemDebugControl,SetProcessAffinityMask,

SPEI计算避坑指南:gma中Distribution和FitMethod参数怎么选?

本文深入探讨了在SPEI计算中如何科学选择gma库中的Distribution和FitMethod参数,帮助研究者避开常见陷阱。详细分析了LogLogistic、Gamma和Pearson3三种分布的适用场景,以及LMoment与MLE拟合方法的优缺点,为气象干旱研究提供实用指南。

weixin_30308101的博客 255

VFIO框架源码分析(一)- 从初始化到设备访问

本文深入剖析了Linux内核中的VFIO(Virtual Function I/O)框架,详细解读了其从初始化到设备访问的全过程。VFIO通过Container->Group->Device的层次化设计,利用IOMMU提供安全隔离,允许用户空间直接访问物理设备。文章基于Linux v5.15版本,重点分析了vfio_init模块入口、Container创建与配置、Group关联以及最终设备访问等关键环节,揭示了VFIO如何通过逐层授权机制构建安全可靠的设备直通模型,为虚拟化技术提供核心支持。

qq_36071928的博客 382

微信图片.dat文件解密实战:用Python一键转PNG(附完整代码)

本文详细介绍了如何通过Python解密微信图片.dat文件并转换为PNG格式的完整教程。文章深入解析了微信.dat文件的异或加密原理,提供了自动检测密钥的Python脚本,并分享了批量解密和性能优化的实用技巧,帮助用户轻松恢复和整理微信聊天图片。

weixin_29096377的博客 472

构建自己的哨兵数据集(以sentinel-1为例,使用SNAP软件)

通过欧洲航天官网获取哨兵数据的产品,通过SNAP软件进一步得到SAR图像(以导出图片为例)

xiaoxTai的博客 6187

【AI知识点】向量空间(vector space)

向量空间(vector space),有时称为线性空间,是数学中线性代数的一部分,它描述了向量的集合以及这些向量可以进行的操作。向量空间是计算机科学、机器学习和自然语言处理(NLP)等领域的基础概念,尤其在表示数据的特征时,向量空间模型得到了广泛应用。

AI完全体 2438

3D打印开源硬件MKS Monster8 V2.0 原理图赏析--更新中

MKS MONSTER8 主板是创客基地为满足市场需求而推出的主板,可用于Voron 2.4机器安装,支Marlin 固件和Klipper固件,支持U盘打印(暂时只有Marlin固件支持),支持TMC驱动UART模式,它包含了3D打印机所需要的主要部件和接口,通过MCU集中控制,是一款功能强大的主板。下面详细分析一下。

我的专栏 7235

Python控制LitePoint IQxel-MW 无线网络测试仪

由于项目需要进行WIFI和BT(蓝牙)的射频测试,所以需要开发一款支持WIFI/BT射频测试的工具。开发射频测试工具的话那肯定离不开仪表的控制。我们项目用的就Litepoint的IQxel-MW无线网络测试仪。这篇文章主要就是介绍一下如何控制仪表以及实现的过程!LitePoint是美国硅谷的一家仪器厂商,主要做一些无线通讯测试仪表,包括WIFI,BT(Bluetooth),LTE等等。

xgh1951的博客 1万+

【C++STL基础入门】stack栈的基础使用

C++ STL(Standard Template Library)是C++标准库中的一个强大的工具集,提供了各种常用的数据结构和算法。其中之一就是Stack(栈),是一种后进先出(LIFO)的数据结构。使用栈可以很方便地管理数据的顺序,它具有简单、高效和易于使用的特点。本文将介绍Stack栈的基础使用方法,帮助初学者快速掌握它的概念和用法。本文简要介绍了C++ STL中Stack栈的基础使用方法。

m0_62599305的博客 3997

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: Do All In One EXE File Under Win32
下一篇: awdBIOS 镜像结构简单分析
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址