2022-11-01 23:15:10

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 15/15] Documentation: remove magic-number.rst

All noted magic numbers have been removed, and we don't want to encourage
magicking up kernel structs going forward.

Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/index.rst | 1 -
Documentation/process/magic-number.rst | 71 -----------------
.../translations/it_IT/process/index.rst | 1 -
.../it_IT/process/magic-number.rst | 77 -------------------
.../translations/zh_CN/process/index.rst | 1 -
.../zh_CN/process/magic-number.rst | 60 ---------------
.../translations/zh_TW/process/index.rst | 1 -
.../zh_TW/process/magic-number.rst | 63 ---------------
8 files changed, 275 deletions(-)
delete mode 100644 Documentation/process/magic-number.rst
delete mode 100644 Documentation/translations/it_IT/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_CN/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_TW/process/magic-number.rst

diff --git a/Documentation/process/index.rst b/Documentation/process/index.rst
index d4b6217472b0..a8c0c4bffa47 100644
--- a/Documentation/process/index.rst
+++ b/Documentation/process/index.rst
@@ -59,7 +59,6 @@ lack of a better place.

applying-patches
adding-syscalls
- magic-number
volatile-considered-harmful
botching-up-ioctls
clang-format
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
deleted file mode 100644
index 5a8c2755ac9c..000000000000
--- a/Documentation/process/magic-number.rst
+++ /dev/null
@@ -1,71 +0,0 @@
-.. _magicnumbers:
-
-Linux magic numbers
-===================
-
-This file is a registry of magic numbers which are in use. When you
-add a magic number to a structure, you should also add it to this
-file, since it is best if the magic numbers used by various structures
-are unique.
-
-It is a **very** good idea to protect kernel data structures with magic
-numbers. This allows you to check at run time whether (a) a structure
-has been clobbered, or (b) you've passed the wrong structure to a
-routine. This last is especially useful --- particularly when you are
-passing pointers to structures via a void * pointer. The tty code,
-for example, does this frequently to pass driver-specific and line
-discipline-specific structures back and forth.
-
-The way to use magic numbers is to declare them at the beginning of
-the structure, like so::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-Please follow this discipline when you are adding future enhancements
-to the kernel! It has saved me countless hours of debugging,
-especially in the screwy cases where an array has been overrun and
-structures following the array have been overwritten. Using this
-discipline, these cases get detected quickly and safely.
-
-Changelog::
-
- Theodore Ts'o
- 31 Mar 94
-
- The magic table is current to Linux 2.1.55.
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
- Now it should be up to date with Linux 2.1.112. Because
- we are in feature freeze time it is very unlikely that
- something will change before 2.2.x. The entries are
- sorted by number field.
-
- Krzysztof G. Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
- Updated the magic table to Linux 2.5.45. Right over the feature freeze,
- but it is possible that some new magic numbers will sneak into the
- kernel before 2.6.x yet.
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
- Updated the magic table to Linux 2.5.74.
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-
-===================== ================ ======================== ==========================================
-Magic Name Number Structure File
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/index.rst b/Documentation/translations/it_IT/process/index.rst
index 8d4e36a07ff4..71adf53bc297 100644
--- a/Documentation/translations/it_IT/process/index.rst
+++ b/Documentation/translations/it_IT/process/index.rst
@@ -56,7 +56,6 @@ perché non si è trovato un posto migliore.

applying-patches
adding-syscalls
- magic-number
volatile-considered-harmful
clang-format
../riscv/patch-acceptance
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
deleted file mode 100644
index 2fbc1876534a..000000000000
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ /dev/null
@@ -1,77 +0,0 @@
-.. include:: ../disclaimer-ita.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-:Translator: Federico Vaga <[email protected]>
-
-.. _it_magicnumbers:
-
-I numeri magici di Linux
-========================
-
-Questo documento è un registro dei numeri magici in uso. Quando
-aggiungete un numero magico ad una struttura, dovreste aggiungerlo anche
-a questo documento; la cosa migliore è che tutti i numeri magici usati
-dalle varie strutture siano unici.
-
-È **davvero** un'ottima idea proteggere le strutture dati del kernel con
-dei numeri magici. Questo vi permette in fase d'esecuzione di (a) verificare
-se una struttura è stata malmenata, o (b) avete passato a una procedura la
-struttura errata. Quest'ultimo è molto utile - particolarmente quando si passa
-una struttura dati tramite un puntatore void \*. Il codice tty, per esempio,
-effettua questa operazione con regolarità passando avanti e indietro le
-strutture specifiche per driver e discipline.
-
-Per utilizzare un numero magico, dovete dichiararlo all'inizio della struttura
-dati, come di seguito::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-Per favore, seguite questa direttiva quando aggiungerete migliorie al kernel!
-Mi ha risparmiato un numero illimitato di ore di debug, specialmente nei casi
-più ostici dove si è andati oltre la dimensione di un vettore e la struttura
-dati che lo seguiva in memoria è stata sovrascritta. Seguendo questa
-direttiva, questi casi vengono identificati velocemente e in sicurezza.
-
-Registro dei cambiamenti::
-
- Theodore Ts'o
- 31 Mar 94
-
- La tabella magica è aggiornata a Linux 2.1.55.
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
- Ora dovrebbe essere aggiornata a Linux 2.1.112. Dato che
- siamo in un momento di congelamento delle funzionalità
- (*feature freeze*) è improbabile che qualcosa cambi prima
- della versione 2.2.x. Le righe sono ordinate secondo il
- campo numero.
-
- Krzysztof G. Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
- Aggiornamento della tabella a Linux 2.5.45. Giusti nel congelamento
- delle funzionalità ma è comunque possibile che qualche nuovo
- numero magico s'intrufoli prima del kernel 2.6.x.
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
- Aggiornamento della tabella magica a Linux 2.5.74.
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-
-===================== ================ ======================== ==========================================
-Nome magico Numero Struttura File
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/index.rst b/Documentation/translations/zh_CN/process/index.rst
index a1a35f88f4ae..300d579b3ad0 100644
--- a/Documentation/translations/zh_CN/process/index.rst
+++ b/Documentation/translations/zh_CN/process/index.rst
@@ -52,7 +52,6 @@
.. toctree::
:maxdepth: 1

- magic-number
volatile-considered-harmful

.. only:: subproject and html
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
deleted file mode 100644
index f8ec4767bc4e..000000000000
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-.. _cn_magicnumbers:
-
-.. include:: ../disclaimer-zh_CN.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-
-如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可
-以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者::
-
- 中文版维护者: 贾威威 Jia Wei Wei <[email protected]>
- 中文版翻译者: 贾威威 Jia Wei Wei <[email protected]>
- 中文版校译者: 贾威威 Jia Wei Wei <[email protected]>
-
-Linux 魔术数
-============
-
-这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。
-
-使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。
-
-使用魔术值的方法是在结构的开始处声明的,如下::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,‪这些情况可以被快速地,安全地避免。
-
- Theodore Ts'o
- 31 Mar 94
-
-给当前的Linux 2.1.55添加魔术表。
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
-现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。
-
- Krzysztof G.Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
-更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
-更新魔术表到Linux 2.5.74。
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-===================== ================ ======================== ==========================================
-魔术数名 数字 结构 文件
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/index.rst b/Documentation/translations/zh_TW/process/index.rst
index c5c59b4fd595..cb3dea0b78ab 100644
--- a/Documentation/translations/zh_TW/process/index.rst
+++ b/Documentation/translations/zh_TW/process/index.rst
@@ -54,7 +54,6 @@
.. toctree::
:maxdepth: 1

- magic-number
volatile-considered-harmful

.. only:: subproject and html
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
deleted file mode 100644
index 0ccc60bee3d6..000000000000
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ /dev/null
@@ -1,63 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-.. _tw_magicnumbers:
-
-.. include:: ../disclaimer-zh_TW.rst
-
-:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
-
-如果想評論或更新本文的內容,請直接發信到LKML。如果你使用英文交流有困難的話,也可
-以向中文版維護者求助。如果本翻譯更新不及時或者翻譯存在問題,請聯繫中文版維護者::
-
- 中文版維護者: 賈威威 Jia Wei Wei <[email protected]>
- 中文版翻譯者: 賈威威 Jia Wei Wei <[email protected]>
- 中文版校譯者: 賈威威 Jia Wei Wei <[email protected]>
- 胡皓文 Hu Haowen <[email protected]>
-
-Linux 魔術數
-============
-
-這個文件是有關當前使用的魔術值註冊表。當你給一個結構添加了一個魔術值,你也應該把這個魔術值添加到這個文件,因爲我們最好把用於各種結構的魔術值統一起來。
-
-使用魔術值來保護內核數據結構是一個非常好的主意。這就允許你在運行期檢查(a)一個結構是否已經被攻擊,或者(b)你已經給一個例行程序通過了一個錯誤的結構。後一種情況特別地有用---特別是當你通過一個空指針指向結構體的時候。tty源碼,例如,經常通過特定驅動使用這種方法並且反覆地排列特定方面的結構。
-
-使用魔術值的方法是在結構的開始處聲明的,如下::
-
- struct tty_ldisc {
- int magic;
- ...
- };
-
-當你以後給內核添加增強功能的時候,請遵守這條規則!這樣就會節省數不清的調試時間,特別是一些古怪的情況,例如,數組超出範圍並且重新寫了超出部分。遵守這個規則,‪這些情況可以被快速地,安全地避免。
-
- Theodore Ts'o
- 31 Mar 94
-
-給當前的Linux 2.1.55添加魔術表。
-
- Michael Chastain
- <mailto:[email protected]>
- 22 Sep 1997
-
-現在應該最新的Linux 2.1.112.因爲在特性凍結期間,不能在2.2.x前改變任何東西。這些條目被數域所排序。
-
- Krzysztof G.Baranowski
- <mailto: [email protected]>
- 29 Jul 1998
-
-更新魔術表到Linux 2.5.45。剛好越過特性凍結,但是有可能還會有一些新的魔術值在2.6.x之前融入到內核中。
-
- Petr Baudis
- <[email protected]>
- 03 Nov 2002
-
-更新魔術表到Linux 2.5.74。
-
- Fabian Frederick
- <[email protected]>
- 09 Jul 2003
-
-===================== ================ ======================== ==========================================
-魔術數名 數字 結構 文件
-===================== ================ ======================== ==========================================
-===================== ================ ======================== ==========================================
--
2.30.2


Attachments:
(No filename) (14.84 kB)
signature.asc (849.00 B)
Download all attachments