From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BA1EC433EF for ; Mon, 2 May 2022 16:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241145AbiEBQLm (ORCPT ); Mon, 2 May 2022 12:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241843AbiEBQLe (ORCPT ); Mon, 2 May 2022 12:11:34 -0400 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95DACDF94 for ; Mon, 2 May 2022 09:07:59 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:39356) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nlYaW-00G66k-43; Mon, 02 May 2022 10:07:52 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:36676 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nlYaV-002zy7-2q; Mon, 02 May 2022 10:07:51 -0600 From: "Eric W. Biederman" To: Alexey Gladkov Cc: LKML , Linus Torvalds , Alexander Mikhalitsyn , Andrew Morton , Christian Brauner , Daniel Walsh , Davidlohr Bueso , Kirill Tkhai , Linux Containers , Manfred Spraul , Serge Hallyn , Varad Gautam , Vasily Averin References: Date: Mon, 02 May 2022 11:07:24 -0500 In-Reply-To: (Alexey Gladkov's message of "Fri, 22 Apr 2022 14:53:37 +0200") Message-ID: <875ymnvryb.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1nlYaV-002zy7-2q;;;mid=<875ymnvryb.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX1+wXehoCMqRnCn8sog7V37uBF8NwpGbygA= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH v1 1/4] ipc: Remove extra1 field abuse to pass ipc namespace X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexey Gladkov writes: > Eric Biederman pointed out that using .extra1 to pass ipc namespace > looks like an ugly hack and there is a better solution. > > Link: https://lore.kernel.org/lkml/87czib9g38.fsf@email.froward.int.ebiederm.org/ > Signed-off-by: Eric W. Biederman > Signed-off-by: Alexey Gladkov > --- > ipc/ipc_sysctl.c | 26 ++++++++------------------ > 1 file changed, 8 insertions(+), 18 deletions(-) > > diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c > index 15210ac47e9e..eb7ba8e0a355 100644 > @@ -55,20 +50,15 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write, > static int proc_ipc_sem_dointvec(struct ctl_table *table, int write, > void *buffer, size_t *lenp, loff_t *ppos) > { > - struct ipc_namespace *ns = table->extra1; > - struct ctl_table ipc_table; > + struct ipc_namespace *ns = > + container_of(table->data, struct ipc_namespace, sem_ctls); > int ret, semmni; > > - memcpy(&ipc_table, table, sizeof(ipc_table)); > - > - ipc_table.extra1 = NULL; > - ipc_table.extra2 = NULL; > - > semmni = ns->sem_ctls[3]; > ret = proc_dointvec(table, write, buffer, lenp, ppos); > > if (!ret) > - ret = sem_check_semmni(current->nsproxy->ipc_ns); > + ret = sem_check_semmni(ns); ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Can you break this one line change into a separate patch? It is a bug fix so that the entire function uses the same ns value. I expect the change would read easier if the change was separate. > > /* > * Reset the semmni value if an error happens. Eric