On 12/2/23 11:47 PM, Kees Cook wrote:
[...]
>> In persistent_ram_init_ecc(), on 64-bit arches DIV_ROUND_UP() will return
>> 64-bit value since persistent_ram_zone::buffer_size has type size_t which
>> is derived from the 64-bit *unsigned long*, while the ecc_blocks variable
>> this value gets assig
Hi Joel,
On 2023-12-01 17:31:20+0100, Joel Granados wrote:
> Hey Thomas.
>
> Thx for the clarifications. I did more of a deep dive into your set and
> have additional comments (in line). I think const-ing all this is a good
> approach. The way forward is to be able to see the entire patch set of
The 'multipaths' field of 'struct mpconf' can be declared as a flexible
array.
The advantages are:
- 1 less indirection when accessing to the 'multipaths' array
- save 1 pointer in the structure
- improve memory usage
- give the opportunity to use __counted_by() for additional safety
It is used only once and that caller would be simpler with
sysctl_is_perm_empty_ctl_header().
So use this sibling function.
Signed-off-by: Thomas Weißschuh
---
fs/proc/proc_sysctl.c | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sys
The functions are only used in the file where they are defined.
Remove them from the header and make them static.
Signed-off-by: Thomas Weißschuh
---
include/linux/nmi.h | 7 ---
kernel/watchdog.c | 10 +-
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/include/lin
It seems it was never used.
Signed-off-by: Thomas Weißschuh
---
include/linux/sysctl.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 61b40ea81f4d..26a38161c28f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -255,8
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that adapt the cgroup-bpf
code.
Signed-off-by: Thomas Weißschuh
---
include/linux/bpf-cgroup.h | 2 +-
include/linux/filter.h | 2 +-
kernel/bpf/cgroup.c| 2 +-
3 files changed, 3 insertio
Problem description:
The kernel contains a lot of struct ctl_table throught the tree.
These are very often 'static' definitions.
It would be good to make the tables unmodifiable by marking them "const"
to avoid accidental or malicious modifications.
This is in line with a general effort to move as
In a future commit the proc_handlers themselves will change to
"const struct ctl_table". As a preparation for that adapt the internal
helper.
Signed-off-by: Thomas Weißschuh
---
kernel/utsname_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/utsname_sysctl.c b/
In a future commit the proc_handlers themselves will change to
"const struct ctl_table". As a preparation for that adapt the internal
helpers.
Signed-off-by: Thomas Weißschuh
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
inde
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that adapt the
permission callbacks.
Signed-off-by: Thomas Weißschuh
---
include/linux/sysctl.h | 2 +-
ipc/ipc_sysctl.c | 2 +-
kernel/ucount.c| 2 +-
net/sysctl_net.c | 2 +-
4 f
In a future commit the proc_handlers themselves will change to
"const struct ctl_table". As a preparation for that adapt the internal
helpers.
Signed-off-by: Thomas Weißschuh
---
kernel/seccomp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/seccomp.c b/kernel/se
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that adapt the
set_ownership callbacks.
Signed-off-by: Thomas Weißschuh
---
include/linux/sysctl.h | 2 +-
net/sysctl_net.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a
Recent changes in the sysctl allow sysctl tables to be put into .rodata.
Signed-off-by: Thomas Weißschuh
---
kernel/sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d60daa4e36fc..e48a60887c7e 100644
--- a/kernel/sysctl.c
+++ b/k
In a future commit the proc_handlers will change to
"const struct ctl_table".
As a preparation for that adapt the logic to work with a temporary
variable, similar to how it is done in other parts of the kernel.
Signed-off-by: Thomas Weißschuh
---
kernel/stackleak.c | 7 ---
1 file changed, 4
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that move this mutable
field from "struct ctl_table" to "struct ctl_table_header".
This is also more correct in general as this is in fact a property of
the header and not the table itself.
Signed-off-
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that adapt the
ctl_table_arg member.
Signed-off-by: Thomas Weißschuh
---
drivers/net/vrf.c | 2 +-
include/linux/sysctl.h | 2 +-
ipc/ipc_sysctl.c
Now that the sysctl core can handle "const struct ctl_table", make
sure that new usages of the struct already enter the tree as const.
Signed-off-by: Thomas Weißschuh
---
scripts/const_structs.checkpatch | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/const_structs.checkpatch b/scrip
This allows sysctl table to be put into read-only data.
Signed-off-by: Thomas Weißschuh
---
fs/proc/proc_sysctl.c | 6 +++---
include/linux/sysctl.h | 10 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index e7fd1680d479.
As a preparation to make all the sysctl code work with
const struct ctl_table switch over the internal function to use the
const variant.
Signed-off-by: Thomas Weißschuh
---
fs/proc/internal.h | 2 +-
fs/proc/proc_sysctl.c | 81 +-
include/li
This is a first example on how to use const struct ctl_table.
Signed-off-by: Thomas Weißschuh
---
fs/proc/proc_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index d09107a5b43f..f2b663e0be33 100644
--- a/fs/proc/proc_sys
In a future commit the sysctl core will only use
"const struct ctl_table". As a preparation for that adapt all the proc
handlers.
Signed-off-by: Thomas Weißschuh
---
arch/arm64/kernel/armv8_deprecated.c | 2 +-
arch/arm64/kernel/fpsimd.c| 2 +-
arch/s390/appldata/appldata_
22 matches
Mail list logo