内核签名机制

华硕主板禁用UEFI安全启动(Disable Secure Boot for ASUS Motherboard) 安装Nvidia驱动时出现以下情况:The distribution-provided pre-install script failed! Are you sure you want to continue?The target kernel has CONFIG_MODULE_SIG set, which means that it supports cryptographic signatu... 阅读详情

Signed kernel module support

From Gentoo Wiki
Jump to:  navigation,  search

Since Linux kernel version 3.7 onwards, support has been added for signed kernel modules. When enabled, the linux kernel will only load kernel modules that are digitally signed with the proper key. This allows further hardening of the system by disallowing unsigned kernel modules, or kernel modules signed with the wrong key, to be loaded. Malicious kernel modules are a common method for loading rootkits on a Linux system.

Enabling module signature verification

Enabling support is a matter of toggling a few settings in the Linux kernel configuration. Unless you want to use your own keypair, this is all that has to be done to enable kernel module support.

Configuring module signature verification

Module signature verification is a kernel feature, so has to be enabled through the Linux kernel configuration. You can find the necessary options under Enable loadable module support.

 [Collapse] 
Kernel configuration Enable module signature verification

--- Enable loadable module support
[*]   Module signature verification
[*]     Require modules to be validly signed
[*]     Automatically sign all modules
      Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->


The option Module signature verification (CONFIG_MODULE_SIG) enables the module signature verification in the Linux kernel. It supports two approaches on signed module support: a rather permissive one and a strict one. By default, the permissive approach is used, which means that the Linux kernel module either has to have a valid signature, or no signature. With the strict approach, a valid signature must be present. In the above example, the strict approach is used by selecting Require modules to be validly signed(CONFIG_MODULE_SIG_FORCE). Another way of enabling this strict approach is to set the kernel boot optionenforcemodulesig=1.

When building the Linux kernel, the kernel modules will not be signed automatically unless you selectAutomatically sign all modules (CONFIG_MODULE_SIG_ALL).

Finally, we need to select the hash algorithm to use with the cryptographic signature. In the above example, we use SHA-512.

Building the kernel with proper keys

When the Linux kernel is building with module signature verification support enabled, then you can use your own keys or have the Linux kernel build infrastructure create a set for you. If you want the Linux kernel build infrastructure to create it for you, just continue as you always do with a make and make modules_install. At the end of the build process, you will notice that signing_key.priv and signing_key.x509 will be available on the root of the Linux kernel sources.

If we want to use our own keys, you can use openssl to create a key pair (private key and public key). The following command, taken from kernel/Makefile, creates such a key pair.

 [Collapse] 
File x509.genkey Key generation configuration file

[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts
  
[ req_distinguished_name ]
O = GenFic
CN = Kernel Signing Key
emailAddress = server.support@genfic.com
  
[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid


user $  openssl req -new -nodes -utf8 -sha512 -days 36500 -batch -x509 -config x509.genkey -outform DER -out signing_key.x509 -keyout signing_key.priv

The resulting files need to be stored as signing_key.x509 and signing_key.priv in the root of the Linux kernel source tree.

The public key part will be build inside the Linux kernel. If you configured the kernel to sign modules, this signing will take place during the make modules_install part.

Validating module signature support

Reboot with the newly configured kernel. In the output of dmesg you should be able to confirm that the proper certificate is loaded:

user $  dmesg | grep MODSIGN
[    2.450021] MODSIGN: Loaded cert 'GenFic: Kernel Signing Key: b923a5f44eae25bbad52c8bf2742e7b7e6fb0c0e'

The kernel modules have the digital signature appended at the end. A simple hexdump can confirm if a signature is present or not:

user $  hexdump -C vxlan.ko | tail
00008880  cf 0e e7 cb 10 9e 98 5f  4b 21 d4 03 ba 3d 7e e7  |......._K!...=~.|
00008890  68 db f9 e3 5f 62 3c c7  d6 6c 84 c7 d6 68 c1 73  |h..._b<..l...h.s|
000088a0  3d d7 5a 38 66 99 12 b8  84 c9 84 45 dd 68 6d 17  |=.Z8f......E.hm.|
000088b0  03 24 dc 9c 6f 6d 11 01  e9 74 82 ea b5 5b 46 07  |.$..om...t...[F.|
000088c0  fe dd 66 97 1a 33 58 3d  6e d0 ac 03 08 16 73 06  |..f..3X=n.....s.|
000088d0  9f 90 c4 eb b3 82 1d 9f  48 8c 5b 51 01 06 01 1e  |........H.[Q....|
000088e0  14 00 00 00 00 00 02 02  7e 4d 6f 64 75 6c 65 20  |........~Module |
000088f0  73 69 67 6e 61 74 75 72  65 20 61 70 70 65 6e 64  |signature append|
00008900  65 64 7e 0a                                       |ed~.|
00008904

The string ~Module signature appended~ at the end confirms that a signature is present. Of course, it does not confirm that the signature is valid or not.

To remove the signature, we can use the strip command:

root #  strip --strip-debug vxlan.ko
root # 
hexdump -C vxlan.ko | tail
00097330  6c 5f 67 65 74 5f 73 74  61 74 73 36 34 00 72 63  |l_get_stats64.rc|
00097340  75 5f 62 61 72 72 69 65  72 00 5f 72 61 77 5f 73  |u_barrier._raw_s|
00097350  70 69 6e 5f 75 6e 6c 6f  63 6b 00 72 65 67 69 73  |pin_unlock.regis|
00097360  74 65 72 5f 70 65 72 6e  65 74 5f 64 65 76 69 63  |ter_pernet_devic|
00097370  65 00 6b 6d 61 6c 6c 6f  63 5f 63 61 63 68 65 73  |e.kmalloc_caches|
00097380  00 6e 65 74 64 65 76 5f  69 6e 66 6f 00 6e 65 69  |.netdev_info.nei|
00097390  67 68 5f 6c 6f 6f 6b 75  70 00 72 65 6c 65 61 73  |gh_lookup.releas|
000973a0  65 5f 73 6f 63 6b 00 72  65 67 69 73 74 65 72 5f  |e_sock.register_|
000973b0  6e 65 74 64 65 76 69 63  65 00                    |netdevice.|
000973ba

If we try to load this module now, we get a failure:

root #  modprobe vxlan
modprobe: ERROR: could not insert 'vxlan': Required key not available

This confirms that modules without a signature are not loaded.

Administering kernel module signatures

Once the kernel boots and we have validated that the signed kernel module support works, it is important to correctly handle the keys themselves.

Protecting the private key

The private key, stored as signing_key.priv, needs to be moved to a secure location (unless you will be creating new keys for new kernels, in which case the file can be removed). Do not keep it at /usr/src/linux on production systems as malware can then easily use this key to sign the malicious kernel modules (such as rootkits) and compromise the system further.

Manually signing modules

If you ever need to manually sign a kernel module, you can use the scripts/sign-file script available in the Linux kernel source tree. It requires four arguments:

  1. The hash algorithm to use, such as sha512
  2. The private key location
  3. The certificate (which includes the public key) location
  4. The kernel module to sign

In this case, the key pair does not need to be named signing_file.priv and such, nor do they need to be in the root of the Linux kernel source tree location.

user $  perl /usr/src/linux/scripts/sign-file sha512 /mnt/sdcard/kernel-signkey.priv /mnt/sdcard/kernel-signkey.x509 vxlan.ko

Distributing the kernel and modules

If we create a kernel package through make tarbz2-pkg, the modules in it will be signed already so we do not need to manually sign them afterwards. The signing keys themselves are not distributed with it.

More resources

In Booting a self-signed Linux kernel Greg Kroah-Hartman describes how to boot a self-signed Linux kernel from EFI. As having signed kernel module support is only secure if the Linux kernel is trusted, this is an important (and related) feature to work with.



原文链接:http://wiki.gentoo.org/wiki/Signed_kernel_module_support

其他参考文章:

1、How to Use Signed Kernel Modules

2、http://www.linuxquestions.org/questions/linux-newbie-8/module-verification-failed-signature-and-or-required-key-missing-tainting-kernel-4175476456/

Linux内核模块签名机制:从原理到实践的安全验证指南 在Linux系统安全领域,内核模块的动态加载机制提供了强大的扩展能力,但也引入了潜在的安全风险。非对称加密技术中的数字签名机制为解决这一问题提供了基础方案,其核心原理是利用公钥和私钥对实现身份认证与完整性校验。该技术的核心价值在于构建可信的代码执行环境,通过密码学手段确保模块来源的真实性和内容的完整性,防止恶意代码潜入内核空间。在应用场景上,模块签名广泛应用于服务器安全加固、嵌入式设备防护以及遵循安全启动规范的现代计算平台。本文聚焦于Linux内核模块签名与验证机制,详细解析了其基于非对称加密的完整工作流程 阅读详情

相关推荐

【深入解析】Linux模块化设计(9)模块签名与安全机制:如何防止恶意代码潜入内核?

安全机制描述模块签名机制防止未经授权的模块加载私钥签发私钥仅限构建端保存,严禁泄露公钥嵌入内核保证加载端的验证不依赖外部强制验证配置启用确保完整性配合 Secure Boot构建端到端可信加载链模块签名机制是 Linux 安全体系的重要组成部分,是将“安全”嵌入到系统运行中的核心能力之一。

NO_Dream_的博客 867

ubuntu安装显卡驱动关于UEFI 的问题

拯救者在ubuntu20.04下安装RTX3060显卡遇到了如下报错: The target kernel has CONFIG_MODULE_SIG set, which means that it supports cryptographic signatures on kernel modules. On some systems, the kernel may refuse to load modules without a valid signature from a trusted key.

qq_40768831的博客 9067

Linux 内核签名(签名内核模块)、linux 驱动签名

一、Linux 内核签名 1. 什么是linux 内核签名 内核在模块加载时使用加密签名验证,校验签名是否与已编译的内核公钥匹配。目前只支持RSA X.509验证。 签名验证在通过CONFIG_MODULE_SIG使能。打开签名同时还会强制做模块ELF元数据检查,然后再做签名验证。 linux内核从3.7 开始加入模块签名检查机制,如果内核选项CONFIG_MODULE_SIG和CONFIG_MODULE_SIG_FORCE打开的话,当加载模块时内核会检查模块的签名, 如果签名不存在或者签名内容不一致,会强

西京刀客 5661

修改bios系统导致的ubuntu循环登录,显卡驱动安装失败

The target kernel has CONFIG_MODULE_SIG set, which means that it supports cryptographic signatures on kernel modules. On some systems, the kernel may refuse to load modules without a valid signature from a trusted key. This system also has UEFI Secure Boot

weixin_37707670的博客 2235

Kernel,内核模块签名机制、CONFIG_MODULE_SIG

内核模块签名机制

mzhan017的博客 1733

Linux内核模块签名与版本检查机制

Linux内核模块签名,Linux内核版本检查机制

thinker 1902

ubuntu 上NVIDIA驱动和CUDA9.0 的坑之一二

1 参考链接[1] NVIDIA 官方CUDA安装文档: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html[2] NVIDIA  对XFree86 下安装驱动的说明: http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/installdri...

lipi37的博客 2万+

AG16K MCU ARM Cortex M3

其中,Input文件为Keil生成的mcu程序文件,输出为合成后的存储格式Bin文件,Program address 为上方表格中“程序运行 RAM 地址(4bytes)”,即 Keil 中设置的程序运行地址。其中 MCU 程序的地址,根据 mcu.ip 中设置的 FLASH_BIAS 进行设置。AG16K MCU 的 FPGA 工程中,需调用 alta_mcu_m3 的硬核 IP,包含在 alta_sim.v 的库文。Quartus II。//MCU 程序在 FLASH 中存放的首地址。

Embeded_FPGA的博客 1806

在Fedora上安装NVIDIA驱动详细教程及解析

Fedora上在有安全启动的情况下安装NVIDIA驱动

April_Zhao的博客 2万+

Proteus 8.15仿真STM32F103C8,ADC采样总为0?别急着换芯片,先检查这3个配置

本文详细解析了在Proteus 8.15中仿真STM32F103C8时ADC采样值为0的常见原因及解决方法。从供电网络配置、时钟设置到ADC参数调整,提供了系统性的排查指南,帮助开发者快速定位问题,避免不必要的硬件更换。重点关注供电网络、时钟分频和ADC配置等关键环节。

weixin_30425949的博客 366

总结所有的池化(Pooling)方法

为什么池化? 池化(Pooling)层和卷积层、全连接层一样,都是卷积神经网络的组成部分。 卷积神经网络中的卷积层会将卷积Filter应用于输入图像,以便创建特征映射来总结输入中这些特征的存在。 卷积层被证明是非常有效的,在深层模型中叠加卷积层可以让接近输入的层学习低层特征(如线条),在模型中更深(高)的层用于学习高阶或者更抽象的特征,如形状或特定对象。 卷积层特征映射输入的一个局限性是它们只能精确记录特征在输入层的位置。这意味着在输入图像中特征位置的小幅移动将导致不同的特征映射。这可以随着重新裁剪

大脸猫的博客 1万+

linux内核签名认证机制,centos内核编译与其签名机制

centos内核编译与其签名机制linux内核3.7引入的签名机制,极大地方便了对内核模块的安全认证,同时也为操作系统厂家提供了IP保护的技术手段。不过,凡事有利也有弊。对刚刚接触具有签名机制的内核的工程师而言,需要一段理解并适应新内核的过程。为此,小编结合自己的工作经历,总结了一些要点和大家一起分享。1.什么是内核签名机制?内核签名就是内核利用公钥对驱动模块校验的过程,对检验通过的模块,准许加载...

weixin_31022521的博客 1565

一文讲透什么是ADC/DAC中的DDC、DUC、采样率以及数据率等概念

摘要:ADC/DAC中的采样率与数据率概念不同,采样率是转换器的时钟速率,而数据率是数字输出的实际速率。抽取通过滤波降低数据速率,提升信噪比但牺牲带宽;内插则通过插零和滤波提高采样率,将镜像信号移远但增加延迟和功耗。JESD204B标准的高速转换器需平衡通道数与串行速率,内插/抽取技术是关键。文章还解析了DDC、DUC的应用及优缺点,为高速数据转换设计提供参考。(150字)

weixin_49761275的博客 4268

centos内核编译与其签名机制

centos内核编译与其签名机制linux内核3.7引入的签名机制,极大地方便了对内核模块的安全认证,同时也为操作系统厂家提供了IP保护的技术手段。不过,凡事有利也有弊。对刚刚接触具有签名机制的内核的工程师而言,需要一段理解并适应新内核的过程。为此,小编结合自己的工作经历,总结了一些要点和大家一起分享 。1.什么是内核签名机制?内核签名就是内核利用公钥对驱动模块校验的过程,对...

weixin_34025151的博客 398

jemalloc实战:5分钟搞定C程序内存泄漏检测(附PDF报告生成技巧)

本文详细介绍了使用jemalloc的heap profiling功能快速检测C/C++程序内存泄漏的实战方法。通过预编译库和LD_PRELOAD注入,无需修改代码即可启动低开销剖析,并利用jeprof工具进行深度分析和生成可视化PDF报告,帮助开发者高效定位线上或开发环境中的内存问题。

i3j4k5的博客 225

炉石传说游戏系统拆解和部分系统分析

一.游戏综述 《炉石传说:魔兽英雄传》是一款由暴雪娱乐公司出品的策略类卡牌游戏。中国大陆地区的独家运营由网易公司代理。2014年3月13日全球同步正式运营。游戏背景设定于暴雪的魔兽系列,共十位魔兽中的角色作为十种不同的职业。而玩家要做的,就是根据己方现有的卡牌组建合适的卡组,指挥英雄,驱动随从,施展法术,与游戏好友或素不相识的对手一决高下。 二.游戏系统拆解图 三.游戏系统部分分析 1. 对战系统 (1)战斗准备 炉石传说开始前都需要配置至少30张卡牌作为出战卡组 .....

Jimmy72236的博客 4926

linux内核签名认证机制,内核签名机制

Signed kernel module supportFrom Gentoo WikiSince Linux kernel version 3.7 onwards, support has been added for signed kernel modules. When enabled, the Linux kernel will only load kernel modules that ...

weixin_39677538的博客 660

头歌工程实训答案-机器学习篇之手写体识别篇

第2关:激活函数'''x:负无穷到正无穷的实数'''if x<=0:return 0else:return x#***第3关:反向传播算法import os。

m0_71537260的博客 2518

Signed kernel module support——内核签名机制

Signed kernel module support——内核签名机制 From : http://blog.csdn.net/u011923747/article/details/18619545

fhqfghgdx blog 2430

基于STM32的嵌入式平台实现EtherCAT主站

本文将介绍如何在基于STM32的嵌入式平台上构建EtherCAT主站,并提供相应的源代码。使用SOEM库提供的API函数,我们可以实现与EtherCAT从站设备的实时通信和数据交换。在STM32的代码中,使用SOEM库提供的API函数初始化EtherCAT主站。在SOEM库中,我们可以找到EtherCAT主站的实现代码和相关的API函数。使用SOEM库提供的API函数实现EtherCAT主站的功能,包括发送和接收EtherCAT数据帧、处理从站设备的状态等。确保连接正常并且设备能够相互通信。

CodeSageX的博客 2833

深度学习工具包 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")

AI Dev Kit表统计收集:TableStatLevel三级剖析深度讲解

AI Dev Kit(ai-dev-kit)是 Databricks 官方提供的 Coding Agents 开发工具包,其中的**表统计收集**(Table Statistics)能力可以让 AI 编程助手快速"看懂"你的数据表:一键获取列名、类型、行数,甚至直方图和百分位数。核心就靠一个三档开关 —— `TableStatLevel`:NONE、SIMPLE、DETAILED 三级,按需取数,

gitblog_00737的博客 1075

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

征程 6X release版本内核模块安全加载

地平线开发者 1114

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

android内核模块签名,android安装内核module,提示Required key not available

最近在调试一个驱动的时候,用insmod加载.ko的时候,提示Required key not available,第一反应是签名有问题,内核模块也开始使用类似apk的签名了吗?查资料后果然是这样。这个问题可以说不算是android的问题,而应该是linux系统的问题,android本身就是个linux系统。下来一步一步分析问题的所在。内核配置内核从3.7后开始支持模块签名,这个功能使能以后,内核...

weixin_32943417的博客 1298

loading out-of-tree module taints kernel

loading out-of-tree module taints kernel

xiaozhi 4211
上一篇: 高通常用缩写
下一篇: Linux Support for ARM LPAE 分析
makeyourprogress
博客等级 码龄11年 26粉丝 57原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值