[4/4] zdtm/ipc_namespace: add msg_next_id, sem_next_id, shm_next_id

Submitted by Pavel Tikhomirov on July 4, 2016, 7:47 a.m.

Details

Message ID 1467618428-1362-5-git-send-email-ptikhomirov@virtuozzo.com
State Rejected
Series "ipc/sysctls: add more sysctls to cr"
Headers show

Commit Message

Pavel Tikhomirov July 4, 2016, 7:47 a.m.
as these sysctls can not be set to -1(default) leave them uninitialized
sometimes

https://jira.sw.ru/browse/PSBM-48397
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 test/zdtm/static/ipc_namespace.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c
index 8120403..f75dc4f 100644
--- a/test/zdtm/static/ipc_namespace.c
+++ b/test/zdtm/static/ipc_namespace.c
@@ -36,6 +36,9 @@  struct ipc_ns {
 	int		msg_bytes;   // +
 	int		msg_hdrs;    // +
 	int		auto_msgmni; // +
+	int		msg_next_id; // +
+	int		sem_next_id; // +
+	int		shm_next_id; // +
 
 	size_t		shm_ctlmax;
 	size_t		shm_ctlall;
@@ -110,6 +113,15 @@  static int get_messages_info(struct ipc_ns *ipc)
 	if (read_ipc_sysctl("/proc/sys/kernel/auto_msgmni",
 			&ipc->auto_msgmni, sizeof(ipc->auto_msgmni)))
 		return -1;
+	if (read_ipc_sysctl("/proc/sys/kernel/msg_next_id",
+			&ipc->msg_next_id, sizeof(ipc->msg_next_id)))
+		return -1;
+	if (read_ipc_sysctl("/proc/sys/kernel/sem_next_id",
+			&ipc->sem_next_id, sizeof(ipc->sem_next_id)))
+		return -1;
+	if (read_ipc_sysctl("/proc/sys/kernel/shm_next_id",
+			&ipc->shm_next_id, sizeof(ipc->shm_next_id)))
+		return -1;
 	if (read_ipc_sysctl("/proc/sys/fs/mqueue/queues_max",
 			(int *)&ipc->mq_queues_max, sizeof(ipc->mq_queues_max)))
 		return -1;
@@ -248,6 +260,8 @@  static int rand_ipc_sem(void)
 	return 0;
 }
 
+#define INT_MAX ((int)(~0U>>1))
+
 static int rand_ipc_ns(void)
 {
 	int ret;
@@ -261,6 +275,12 @@  static int rand_ipc_ns(void)
 		ret = rand_ipc_sysctl("/proc/sys/kernel/msgmni", (unsigned)lrand48());
 	if (!ret)
 		ret = rand_ipc_sysctl("/proc/sys/kernel/auto_msgmni", 0);
+	if (!ret && (unsigned)lrand48() % 2)
+		ret = rand_ipc_sysctl("/proc/sys/kernel/msg_next_id", (unsigned)lrand48() % ((unsigned)INT_MAX + 1));
+	if (!ret && (unsigned)lrand48() % 2)
+		ret = rand_ipc_sysctl("/proc/sys/kernel/sem_next_id", (unsigned)lrand48() % ((unsigned)INT_MAX + 1));
+	if (!ret && (unsigned)lrand48() % 2)
+		ret = rand_ipc_sysctl("/proc/sys/kernel/shm_next_id", (unsigned)lrand48() % ((unsigned)INT_MAX + 1));
 	if (!ret)
 		ret = rand_ipc_sysctl("/proc/sys/kernel/shmmax", (unsigned)lrand48());
 	if (!ret)
@@ -317,6 +337,15 @@  static void show_ipc_entry(struct ipc_ns *old, struct ipc_ns *new)
 	if (old->auto_msgmni != new->auto_msgmni)
 		pr_perror("auto_msgmni differs: %d ---> %d",
 			old->auto_msgmni, new->auto_msgmni);
+	if (old->msg_next_id != new->msg_next_id)
+		pr_perror("msg_next_id differs: %d ---> %d",
+			old->msg_next_id, new->msg_next_id);
+	if (old->sem_next_id != new->sem_next_id)
+		pr_perror("sem_next_id differs: %d ---> %d",
+			old->sem_next_id, new->sem_next_id);
+	if (old->shm_next_id != new->shm_next_id)
+		pr_perror("shm_next_id differs: %d ---> %d",
+			old->shm_next_id, new->shm_next_id);
 	if (old->shm_ctlmax != new->shm_ctlmax)
 		pr_perror("shm_ctlmax differs: %d ---> %d",
 			old->shm_ctlmax, new->shm_ctlmax);

Comments

Pavel Emelianov Aug. 4, 2016, 1:52 p.m.
On 07/04/2016 10:47 AM, Pavel Tikhomirov wrote:
> as these sysctls can not be set to -1(default) leave them uninitialized
> sometimes
> 
> https://jira.sw.ru/browse/PSBM-48397
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

Would you rebase this onto recent criu-dev, thanks.
Pavel Tikhomirov Aug. 15, 2016, 1:28 p.m.
On 08/04/2016 04:52 PM, Pavel Emelyanov wrote:
> On 07/04/2016 10:47 AM, Pavel Tikhomirov wrote:
>> as these sysctls can not be set to -1(default) leave them uninitialized
>> sometimes
>>
>> https://jira.sw.ru/browse/PSBM-48397
>> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
>
> Would you rebase this onto recent criu-dev, thanks.

It seem to apply cleanly on recent criu-dev for me.(on top of commit 
43bc4be364ea)

>
Pavel Emelianov Aug. 23, 2016, 2:05 p.m.
On 08/15/2016 04:28 PM, Pavel Tikhomirov wrote:
> 
> 
> On 08/04/2016 04:52 PM, Pavel Emelyanov wrote:
>> On 07/04/2016 10:47 AM, Pavel Tikhomirov wrote:
>>> as these sysctls can not be set to -1(default) leave them uninitialized
>>> sometimes
>>>
>>> https://jira.sw.ru/browse/PSBM-48397
>>> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
>>
>> Would you rebase this onto recent criu-dev, thanks.
> 
> It seem to apply cleanly on recent criu-dev for me.(on top of commit 
> 43bc4be364ea)

With fuzz. Applied, thanks.