Kernel

共 257 篇文章。

malloc(3)换了!

• Kernel

Jason Evans同学返回FreeBSD的第一件事就是把malloc(3)的实现换掉了。这个完全重写的malloc(3)实现带来了以下功能:

  • 防止CPU之间发生冲突的分配场(arenas)概念。
  • 类似slab allocator的分配机制。
  • 释放-分配时的对象cache机制。

仅manpage和malloc.c的patchset就超过150K,值得一读。

参与评论

准备FreeBSD-SA-06:01

• Security

受影响的版本:FreeBSD 6.0-RELEASE, FreeBSD 5.4-STABLE, FreeBSD 6.0-STABLE, FreeBSD 7.0-CURRENT
问题描述:已经确认,在内核中存在一处程序设计缺陷,这一缺陷会导致内核中的某个不确定位置的内存被返回给用户态应用程序。

阅读全文… ( 本文约 174 字,阅读大致需要 1 分钟 )

一个不太明显的安全问题

• Security

在内核里面,程序的结构大概是这样:

函数开始……
struct bar foo;

某些处理(没动foo),然后……
strlcpy(foo.field, k->field, sizeof(k->field));

其他对foo其他字段的赋值处理……

最后
error = copyout(&foo, someaddress, sizeof(foo));

现在问题来了,上面这些东西的问题是什么?应该如何解决?

阅读全文… ( 本文约 219 字,阅读大致需要 1 分钟 )

关于system call

• Kernel

在 FreeBSD 开发手册 中,有一部分内容介绍了关于系统调用。里面有这样一段话:

Linux is a UNIX like system. However, its kernel uses the same system-call convention of passing parameters in registers MS-DOS does. As with the UNIX convention, the function number is placed in EAX. The parameters, however, are not passed on the stack but in EBX, ECX, EDX, ESI, EDI, EBP:

open:
  mov eax, 5
  mov ebx, path
  mov ecx, flags
  mov edx, mode
  int 80h

This convention has a great disadvantage over the UNIX way, at least as far as assembly language programming is concerned: Every time you make a kernel call you must push the registers, then pop them later. This makes your code bulkier and slower. Nevertheless, FreeBSD gives you a choice.

可能有人会问了,为什么说 UNIX way (将参数压栈) 更好呢?

阅读全文… ( 本文约 606 字,阅读大致需要 2 分钟 )

freefall is now running 6.0-STABLE

• Kernel

After it has runned 4.x series for a too long time, finally kensmith@ has stepped up to upgrade it.

Needless to say what this means, just upgrade all your boxes to FreeBSD 6.x. FreeBSD 6.0-RELEASE is the best release we have released in the recent years, and the best .0 release ever, as proven by many installations and developers’ code review.

参与评论

历史上最成功的RELEASE

• Kernel

昨天Scott Long老大发了一封信说,从过去一个月内的反馈来看,6.0-RELEASE是FreeBSD近几年最为成功的发行版本,同时,也是FreeBSD历史上最为成功的.0发行版本。

阅读全文… ( 本文约 124 字,阅读大致需要 1 分钟 )

Lazy blog updates

• Life

In the last month we were busy working to repair the current system at corporation to make sure it would not get worse. Work range from in-depth code review, kernel debugging, to fix data hard disk driver by hand, etc. I am pleased to say that the situation was greatly improved.

阅读全文… ( 本文约 62 字,阅读大致需要 1 分钟 )

*BSD queue.h

• Kernel

Derived from the ancient BSD Unix, *BSD has a set of queue related macros which are described in queue(3), and implemented in src/sys/sys/queue.h. These are primarily used in the kernel, but also useful for userland applications.

阅读全文… ( 本文约 100 字,阅读大致需要 1 分钟 )