lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240904012200.2010916-1-lihongbo22@huawei.com>
Date: Wed, 4 Sep 2024 09:22:00 +0800
From: Hongbo Li <lihongbo22@...wei.com>
To: <gregkh@...uxfoundation.org>
CC: <lihongbo22@...wei.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH -next] uio: Constify struct kobj_type

These 'struct kobj_type' are not modified. They are only used in
kobject_init() which takes a 'const struct kobj_type *ktype'
parameter.

Constifying these structure and moving them to a read-only
section (from data to text), and can increase over all security.

```
[Before]
   text   data    bss    dec    hex    filename
  10330   1908     20  12258   2fe2    drivers/uio/uio.o

[After]
  text    data    bss    dec    hex    filename
  10458   1844     20  12322   3022    drivers/uio/uio.o
```

Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
---
 drivers/uio/uio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 20d2a55cb40b..004a549c6c7d 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -118,7 +118,7 @@ static const struct sysfs_ops map_sysfs_ops = {
 	.show = map_type_show,
 };
 
-static struct kobj_type map_attr_type = {
+static const struct kobj_type map_attr_type = {
 	.release	= map_release,
 	.sysfs_ops	= &map_sysfs_ops,
 	.default_groups	= map_groups,
@@ -207,7 +207,7 @@ static const struct sysfs_ops portio_sysfs_ops = {
 	.show = portio_type_show,
 };
 
-static struct kobj_type portio_attr_type = {
+static const struct kobj_type portio_attr_type = {
 	.release	= portio_release,
 	.sysfs_ops	= &portio_sysfs_ops,
 	.default_groups	= portio_groups,
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ