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>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 29 Jun 2024 10:54:15 +0000
From: lin jia <chinasjtu@....com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Thomas Weißschuh  <thomas@...ch.de>
Subject: can anyone explain the meaning of improvement of try_attach function
 in sysctl.c?

Hi all:
   I've been reading the sysctl part of the Linux kernel source code( 3.3.8) recently and encountered some issues. I'm not sure who I can ask for help.
   In sysctl.c ,  the function of __register_sysctl_paths is to register a sysctl hierarchy,  I am confused by the function " try_attach", 

/* see if attaching q to p would be an improvement */
static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)

what is the meaning of "improvement",  I don’t know the matching standard for the entry in the list

another question is , why not break when variable is_better and not_in_parent is true, so as to save time,  when I config about 2k~4k net device objects in system,  "register_net_sysctl_table" cost considerable time.

For example 

	struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
	struct ctl_table *next;
	int is_better = 0;
	int not_in_parent = !p->attached_by;

	while ((next = is_branch_in(by, to)) != NULL) {
		if (by == q->attached_by)
			is_better = 1;
		if (to == p->attached_by)
			not_in_parent = 1;
		by = by->child;
		to = next->child;
        《-----------------   if(is_better && not_in_parent) break;
    
	}

	if (is_better && not_in_parent) {
		q->attached_by = by;
		q->attached_to = to;
		q->parent = p;
	}
} 

Thanks to all.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ