static-httpd

Sitio web estático (HTML + CSS) que sostiene el blog del autor
Log | Files | Refs

commit 5f607a06d2b395a91a891ff4b250982f3b2aa798
parent dea5d4970eff626350775cb82472b7679313e128
Author: fjbalon <fjbalon@templier.es>
Date:   Thu,  9 Jul 2026 23:34:46 +0200

Actualizado código html de diff del artículo de la ley ab con mejora estética

Diffstat:
Mab-1043-linux/index.html | 358++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 179 insertions(+), 179 deletions(-)

diff --git a/ab-1043-linux/index.html b/ab-1043-linux/index.html @@ -21,205 +21,205 @@ <p>b. La fecha de nacimiento registrada indica que el usuario es menor de 18 años.</p> <p>Se ha añadido el nuevo <emb>errno</emb>, <emb>ETOOYOUNG (134)</emb>. De esta forma el espacio de usuario o la propia distribución pueda manejar el error mostrando un mensaje tranquilizador. El autor sugiere «se requiere un padre o tutor legal que cree el archivo en su nombre».</p> <p>Aquí está todo el código del <emb>diff</emb> para quien le interese:</p> -<pre><code>@@ -42,6 +42,23 @@ source "fs/crypto/Kconfig" +<pre><code class="diff"><span class="hunk">@@ -42,6 +42,23 @@ source "fs/crypto/Kconfig"</span> source "fs/verity/Kconfig" source "fs/notify/Kconfig" -+config VFS_AGE_VERIFICATION -+ bool "Require birth date verification for file creation" -+ default y -+ help -+ When enabled, every process must register a valid birth date via -+ prctl(PR_SET_BIRTHDATE, day, month, year) before being allowed to -+ create files. Processes that have not registered a birth date or -+ whose registered birth date indicates they are under 18 years of -+ age will receive -ETOOYOUNG on any file creation attempt. -+ -+ If unsure, say Y. Failure to comply may result in stern letters -+ from lawyers. You don't want that. Trust us. Say Y. -+ +<span class="add">+config VFS_AGE_VERIFICATION</span> +<span class="add">+ bool "Require birth date verification for file creation"</span> +<span class="add">+ default y</span> +<span class="add">+ help</span> +<span class="add">+ When enabled, every process must register a valid birth date via</span> +<span class="add">+ prctl(PR_SET_BIRTHDATE, day, month, year) before being allowed to</span> +<span class="add">+ create files. Processes that have not registered a birth date or</span> +<span class="add">+ whose registered birth date indicates they are under 18 years of</span> +<span class="add">+ age will receive -ETOOYOUNG on any file creation attempt.</span> +<span class="add">+</span> +<span class="add">+ If unsure, say Y. Failure to comply may result in stern letters</span> +<span class="add">+ from lawyers. You don't want that. Trust us. Say Y.</span> +<span class="add">+</span> source "fs/quota/Kconfig" source "fs/autofs/Kconfig" -diff --git a/include/uapi/asm-generic/errno.h b/include/uapi/asm-generic/errno.h -index 1..2 100644 ---- a/include/uapi/asm-generic/errno.h -+++ b/include/uapi/asm-generic/errno.h -@@ -20,4 +20,6 @@ +<span class="info">diff --git a/include/uapi/asm-generic/errno.h b/include/uapi/asm-generic/errno.h</span> +<span class="info">index 1..2 100644</span> +<span class="info">--- a/include/uapi/asm-generic/errno.h</span> +<span class="info">+++ b/include/uapi/asm-generic/errno.h</span> +<span class="hunk">@@ -20,4 +20,6 @@</span> - #define EHWPOISON 133 /* Memory page has hardware error */ + #define EHWPOISON 133 /* Memory page has hardware error */ -+#define ETOOYOUNG 134 /* Process too young to create content */ -+ +<span class="add">+#define ETOOYOUNG 134 /* Process too young to create content */</span> +<span class="add">+</span> #endif -diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h -index 3..4 100644 ---- a/include/uapi/linux/prctl.h -+++ b/include/uapi/linux/prctl.h -@@ -328,4 +328,8 @@ +<span class="info">diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h</span> +<span class="info">index 3..4 100644</span> +<span class="info">--- a/include/uapi/linux/prctl.h</span> +<span class="info">+++ b/include/uapi/linux/prctl.h</span> +<span class="hunk">@@ -328,4 +328,8 @@</span> #define PR_LOCK_INDIR_BR_LP_STATUS 82 -+/* age verification for file creation */ -+#define PR_SET_BIRTHDATE 83 -+#define PR_GET_BIRTHDATE 84 -+ +<span class="add">+/* age verification for file creation */</span> +<span class="add">+#define PR_SET_BIRTHDATE 83</span> +<span class="add">+#define PR_GET_BIRTHDATE 84</span> +<span class="add">+</span> #endif /* _LINUX_PRCTL_H */ -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 5..6 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1215,6 +1215,14 @@ struct task_struct { +<span class="info">diff --git a/include/linux/sched.h b/include/linux/sched.h</span> +<span class="info">index 5..6 100644</span> +<span class="info">--- a/include/linux/sched.h</span> +<span class="info">+++ b/include/linux/sched.h</span> +<span class="hunk">@@ -1215,6 +1215,14 @@ struct task_struct {</span> #endif - struct seccomp seccomp; - struct syscall_user_dispatch syscall_dispatch; -+ -+#ifdef CONFIG_VFS_AGE_VERIFICATION -+ /* compliance - birth date for age verification */ -+ u8 birthdate_day; -+ u8 birthdate_month; -+ u16 birthdate_year; -+ bool birthdate_verified; -+#endif + struct seccomp seccomp; + struct syscall_user_dispatch syscall_dispatch; +<span class="add">+</span> +<span class="add">+#ifdef CONFIG_VFS_AGE_VERIFICATION</span> +<span class="add">+ /* compliance - birth date for age verification */</span> +<span class="add">+ u8 birthdate_day;</span> +<span class="add">+ u8 birthdate_month;</span> +<span class="add">+ u16 birthdate_year;</span> +<span class="add">+ bool birthdate_verified;</span> +<span class="add">+#endif</span> - /* Thread group tracking: */ - u64 parent_exec_id; -diff --git a/kernel/sys.c b/kernel/sys.c -index 7..8 100644 ---- a/kernel/sys.c -+++ b/kernel/sys.c -@@ -2345,6 +2345,48 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, - break; -+ -+#ifdef CONFIG_VFS_AGE_VERIFICATION -+ case PR_SET_BIRTHDATE: -+ { -+ u8 day = (u8)arg2; -+ u8 month = (u8)arg3; -+ u16 year = (u16)arg4; -+ struct tm now; -+ int age; -+ -+ /* Basic date validation */ -+ if (month < 1 || month > 12) -+ return -EINVAL; -+ if (day < 1 || day > 31) -+ return -EINVAL; -+ if (year < 1900) -+ return -EINVAL; -+ -+ time64_to_tm(ktime_get_real_seconds(), 0, &now); -+ -+ /* The kernel does not support vampires or immortal entities */ -+ if ((now.tm_year + 1900) - year > 150) -+ return -EINVAL; -+ -+ /* No time travelers either */ -+ if (year > (now.tm_year + 1900)) -+ return -EINVAL; -+ -+ me->birthdate_day = day; -+ me->birthdate_month = month; -+ me->birthdate_year = year; -+ me->birthdate_verified = true; -+ -+ age = (now.tm_year + 1900) - year; -+ if (now.tm_mon + 1 < month || -+ (now.tm_mon + 1 == month && now.tm_mday < day)) -+ age--; -+ -+ if (age < 18) -+ pr_info_ratelimited("Process %d (comm: %s) registered as minor (age %d). " -+ "File creation will be denied. Please ask a " -+ "parent or guardian for assistance.\n", -+ task_pid_nr(me), me->comm, age); -+ break; -+ } -+ case PR_GET_BIRTHDATE: -+ if (!me->birthdate_verified) -+ return -EINVAL; -+ if (put_user(me->birthdate_day, (u8 __user *)arg2) || -+ put_user(me->birthdate_month, (u8 __user *)arg3) || -+ put_user(me->birthdate_year, (u16 __user *)arg4)) -+ return -EFAULT; -+ break; -+#endif /* CONFIG_VFS_AGE_VERIFICATION */ -+ - default: - error = -EINVAL; - break; -diff --git a/fs/namei.c b/fs/namei.c -index 9..10 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4148,6 +4148,45 @@ static int vfs_mknodat(struct mnt_idmap *idmap, struct dentry *dentry, - umode_t mode, dev_t dev); + /* Thread group tracking: */ + u64 parent_exec_id; +<span class="info">diff --git a/kernel/sys.c b/kernel/sys.c</span> +<span class="info">index 7..8 100644</span> +<span class="info">--- a/kernel/sys.c</span> +<span class="info">+++ b/kernel/sys.c</span> +<span class="hunk">@@ -2345,6 +2345,48 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,</span> + break; +<span class="add">+</span> +<span class="add">+#ifdef CONFIG_VFS_AGE_VERIFICATION</span> +<span class="add">+ case PR_SET_BIRTHDATE:</span> +<span class="add">+ {</span> +<span class="add">+ u8 day = (u8)arg2;</span> +<span class="add">+ u8 month = (u8)arg3;</span> +<span class="add">+ u16 year = (u16)arg4;</span> +<span class="add">+ struct tm now;</span> +<span class="add">+ int age;</span> +<span class="add">+</span> +<span class="add">+ /* Basic date validation */</span> +<span class="add">+ if (month &lt; 1 || month &gt; 12)</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+ if (day &lt; 1 || day &gt; 31)</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+ if (year &lt; 1900)</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+</span> +<span class="add">+ time64_to_tm(ktime_get_real_seconds(), 0, &amp;now);</span> +<span class="add">+</span> +<span class="add">+ /* The kernel does not support vampires or immortal entities */</span> +<span class="add">+ if ((now.tm_year + 1900) - year &gt; 150)</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+</span> +<span class="add">+ /* No time travelers either */</span> +<span class="add">+ if (year &gt; (now.tm_year + 1900))</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+</span> +<span class="add">+ me-&gt;birthdate_day = day;</span> +<span class="add">+ me-&gt;birthdate_month = month;</span> +<span class="add">+ me-&gt;birthdate_year = year;</span> +<span class="add">+ me-&gt;birthdate_verified = true;</span> +<span class="add">+</span> +<span class="add">+ age = (now.tm_year + 1900) - year;</span> +<span class="add">+ if (now.tm_mon + 1 &lt; month ||</span> +<span class="add">+ (now.tm_mon + 1 == month &amp;&amp; now.tm_mday &lt; day))</span> +<span class="add">+ age--;</span> +<span class="add">+</span> +<span class="add">+ if (age &lt; 18)</span> +<span class="add">+ pr_info_ratelimited("Process %d (comm: %s) registered as minor (age %d). "</span> +<span class="add">+ "File creation will be denied. Please ask a "</span> +<span class="add">+ "parent or guardian for assistance.\n",</span> +<span class="add">+ task_pid_nr(me), me-&gt;comm, age);</span> +<span class="add">+ break;</span> +<span class="add">+ }</span> +<span class="add">+ case PR_GET_BIRTHDATE:</span> +<span class="add">+ if (!me-&gt;birthdate_verified)</span> +<span class="add">+ return -EINVAL;</span> +<span class="add">+ if (put_user(me-&gt;birthdate_day, (u8 __user *)arg2) ||</span> +<span class="add">+ put_user(me-&gt;birthdate_month, (u8 __user *)arg3) ||</span> +<span class="add">+ put_user(me-&gt;birthdate_year, (u16 __user *)arg4))</span> +<span class="add">+ return -EFAULT;</span> +<span class="add">+ break;</span> +<span class="add">+#endif /* CONFIG_VFS_AGE_VERIFICATION */</span> +<span class="add">+</span> + default: + error = -EINVAL; + break; +<span class="info">diff --git a/fs/namei.c b/fs/namei.c</span> +<span class="info">index 9..10 100644</span> +<span class="info">--- a/fs/namei.c</span> +<span class="info">+++ b/fs/namei.c</span> +<span class="hunk">@@ -4148,6 +4148,45 @@ static int vfs_mknodat(struct mnt_idmap *idmap, struct dentry *dentry,</span> + umode_t mode, dev_t dev); -+#ifdef CONFIG_VFS_AGE_VERIFICATION -+/** -+ * check_age_verification - verify the calling process has registered a valid -+ * birth date and is old enough to create files. -+ * -+ * Returns 0 if the caller is verified as an adult (>= 18 years old). -+ * Returns -ETOOYOUNG if the caller is a minor or has not registered a -+ * birth date. -+ * -+ * This function exists because the fundamental UNIX -+ * principle of "everything is a file" was insufficiently regulated. -+ */ -+static int check_age_verification(void) -+{ -+ struct task_struct *tsk = current; -+ struct tm now; -+ int age; -+ -+ if (!tsk->birthdate_verified) { -+ pr_warn_ratelimited( -+ "Process %d (comm: %s) attempted to create a file " -+ "without age verification. Set birth date via " -+ "prctl(PR_SET_BIRTHDATE, day, month, year).\n", -+ task_pid_nr(tsk), tsk->comm); -+ return -ETOOYOUNG; -+ } -+ -+ time64_to_tm(ktime_get_real_seconds(), 0, &now); -+ -+ age = (now.tm_year + 1900) - tsk->birthdate_year; -+ if (now.tm_mon + 1 < tsk->birthdate_month || -+ (now.tm_mon + 1 == tsk->birthdate_month && -+ now.tm_mday < tsk->birthdate_day)) -+ age--; -+ -+ if (age < 18) { -+ pr_warn_ratelimited( -+ "Process %d (comm: %s) is only %d years old. " -+ "Must be 18 or older to create files. " -+ "Ask a parent or guardian for help.\n", -+ task_pid_nr(tsk), tsk->comm, age); -+ return -ETOOYOUNG; -+ } -+ -+ return 0; -+} -+#endif /* CONFIG_VFS_AGE_VERIFICATION */ -+ +<span class="add">+#ifdef CONFIG_VFS_AGE_VERIFICATION</span> +<span class="add">+/**</span> +<span class="add">+ * check_age_verification - verify the calling process has registered a valid</span> +<span class="add">+ * birth date and is old enough to create files.</span> +<span class="add">+ *</span> +<span class="add">+ * Returns 0 if the caller is verified as an adult (&gt;= 18 years old).</span> +<span class="add">+ * Returns -ETOOYOUNG if the caller is a minor or has not registered a</span> +<span class="add">+ * birth date.</span> +<span class="add">+ *</span> +<span class="add">+ * This function exists because the fundamental UNIX</span> +<span class="add">+ * principle of "everything is a file" was insufficiently regulated.</span> +<span class="add">+ */</span> +<span class="add">+static int check_age_verification(void)</span> +<span class="add">+{</span> +<span class="add">+ struct task_struct *tsk = current;</span> +<span class="add">+ struct tm now;</span> +<span class="add">+ int age;</span> +<span class="add">+</span> +<span class="add">+ if (!tsk-&gt;birthdate_verified) {</span> +<span class="add">+ pr_warn_ratelimited(</span> +<span class="add">+ "Process %d (comm: %s) attempted to create a file "</span> +<span class="add">+ "without age verification. Set birth date via "</span> +<span class="add">+ "prctl(PR_SET_BIRTHDATE, day, month, year).\n",</span> +<span class="add">+ task_pid_nr(tsk), tsk-&gt;comm);</span> +<span class="add">+ return -ETOOYOUNG;</span> +<span class="add">+ }</span> +<span class="add">+</span> +<span class="add">+ time64_to_tm(ktime_get_real_seconds(), 0, &amp;now);</span> +<span class="add">+</span> +<span class="add">+ age = (now.tm_year + 1900) - tsk-&gt;birthdate_year;</span> +<span class="add">+ if (now.tm_mon + 1 &lt; tsk-&gt;birthdate_month ||</span> +<span class="add">+ (now.tm_mon + 1 == tsk-&gt;birthdate_month &amp;&amp;</span> +<span class="add">+ now.tm_mday &lt; tsk-&gt;birthdate_day))</span> +<span class="add">+ age--;</span> +<span class="add">+</span> +<span class="add">+ if (age &lt; 18) {</span> +<span class="add">+ pr_warn_ratelimited(</span> +<span class="add">+ "Process %d (comm: %s) is only %d years old. "</span> +<span class="add">+ "Must be 18 or older to create files. "</span> +<span class="add">+ "Ask a parent or guardian for help.\n",</span> +<span class="add">+ task_pid_nr(tsk), tsk-&gt;comm, age);</span> +<span class="add">+ return -ETOOYOUNG;</span> +<span class="add">+ }</span> +<span class="add">+</span> +<span class="add">+ return 0;</span> +<span class="add">+}</span> +<span class="add">+#endif /* CONFIG_VFS_AGE_VERIFICATION */</span> +<span class="add">+</span> /** * vfs_create - create new file - * @idmap: idmap of the mount the inode was found from -@@ -4170,6 +4209,12 @@ int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode, - if (error) - return error; + * @idmap: idmap of the mount the inode was found from +<span class="hunk">@@ -4170,6 +4209,12 @@ int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode,</span> + if (error) + return error; -+#ifdef CONFIG_VFS_AGE_VERIFICATION -+ error = check_age_verification(); -+ if (error) -+ return error; -+#endif -+ - if (!dir->i_op->create) - return -EACCES; /* shouldn't it be ENOSYS? */ +<span class="add">+#ifdef CONFIG_VFS_AGE_VERIFICATION</span> +<span class="add">+ error = check_age_verification();</span> +<span class="add">+ if (error)</span> +<span class="add">+ return error;</span> +<span class="add">+#endif</span> +<span class="add">+</span> + if (!dir-&gt;i_op-&gt;create) + return -EACCES; /* shouldn't it be ENOSYS? */ --- +<span class="del">--</span> 2.49.0</code></pre> <p>Entre las partes más interesantes, a mi parecer, son que con este parche, el Kernel de Linux no soportará deliberadamente el uso de vampiros ni entidades inmortales, estableciendo un condicional que si, la fecha es superior a 150 años en el pasado, devuelve error.</p> <pre><code>/* The kernel does not support vampires or immortal entities */