如何通过 11 位字段中的 12 位掩码打开 SETUID 位?
How can the SETUID bit be turned on by a 12-bit mask in a 11-bit field?
在 Andrew S. Tanenbaum 和 Albert S. Woodhull 的操作系统设计和实现中,有以下片段:
In MINIX 3 every file has an 11-bit mode used for protection. Nine of these bits are the read-
write-execute bits for the owner, group, and others.
然后,几行之后,他们写道:
The other two protection bits, 02000 [octal 200] and 04000 [octal 400], are the SETGID (set-group-id) and SETUID (set-
user-id) bits, respectively.
但是Python表明八进制400是一个12位长掩码:
>>> len(str(bin(0o4000))) - len('0b')
12
如何将 12 位长的掩码应用于 11 位字段?
01000是Unix中的"sticky"位,本书出版时Minix还不支持。它直到 2010 年才添加支持(该书于 2005 年发布)。
在 Andrew S. Tanenbaum 和 Albert S. Woodhull 的操作系统设计和实现中,有以下片段:
In MINIX 3 every file has an 11-bit mode used for protection. Nine of these bits are the read- write-execute bits for the owner, group, and others.
然后,几行之后,他们写道:
The other two protection bits, 02000 [octal 200] and 04000 [octal 400], are the SETGID (set-group-id) and SETUID (set- user-id) bits, respectively.
但是Python表明八进制400是一个12位长掩码:
>>> len(str(bin(0o4000))) - len('0b')
12
如何将 12 位长的掩码应用于 11 位字段?
01000是Unix中的"sticky"位,本书出版时Minix还不支持。它直到 2010 年才添加支持(该书于 2005 年发布)。