[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhS4TKvTyUB+H6cQNjRFbssGRM-U6S-X7011bSv7bHiQqg@mail.gmail.com>
Date: Mon, 26 Aug 2024 21:56:29 -0400
From: Paul Moore <paul@...l-moore.com>
To: yukaixiong <yukaixiong@...wei.com>
Cc: akpm@...ux-foundation.org, mcgrof@...nel.org, ysato@...rs.sourceforge.jp,
dalias@...c.org, glaubitz@...sik.fu-berlin.de, luto@...nel.org,
tglx@...utronix.de, bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
viro@...iv.linux.org.uk, brauner@...nel.org, jack@...e.cz, kees@...nel.org,
j.granados@...sung.com, willy@...radead.org, Liam.Howlett@...cle.com,
vbabka@...e.cz, lorenzo.stoakes@...cle.com, trondmy@...nel.org,
anna@...nel.org, chuck.lever@...cle.com, jlayton@...nel.org, neilb@...e.de,
okorniev@...hat.com, Dai.Ngo@...cle.com, tom@...pey.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, jmorris@...ei.org,
linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, linux-nfs@...r.kernel.org,
netdev@...r.kernel.org, linux-security-module@...r.kernel.org,
wangkefeng.wang@...wei.com
Subject: Re: [PATCH -next 07/15] security: min_addr: move sysctl into its own file
On Mon, Aug 26, 2024 at 9:38 PM yukaixiong <yukaixiong@...wei.com> wrote:
> On 2024/8/27 6:49, Paul Moore wrote:
> > On Mon, Aug 26, 2024 at 8:05 AM Kaixiong Yu <yukaixiong@...wei.com> wrote:
> >> The dac_mmap_min_addr belongs to min_addr.c, move it into
> >> its own file from /kernel/sysctl.c. In the previous Linux kernel
> >> boot process, sysctl_init_bases needs to be executed before
> >> init_mmap_min_addr, So, register_sysctl_init should be executed
> >> before update_mmap_min_addr in init_mmap_min_addr.
> >>
> >> Signed-off-by: Kaixiong Yu <yukaixiong@...wei.com>
> >> ---
> >> kernel/sysctl.c | 9 ---------
> >> security/min_addr.c | 11 +++++++++++
> >> 2 files changed, 11 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> >> index 41d4afc978e6..0c0bab3dad7d 100644
> >> --- a/kernel/sysctl.c
> >> +++ b/kernel/sysctl.c
> >> @@ -2059,15 +2059,6 @@ static struct ctl_table vm_table[] = {
> >> .proc_handler = proc_dointvec_minmax,
> >> .extra1 = SYSCTL_ZERO,
> >> },
> >> -#ifdef CONFIG_MMU
> >> - {
> >> - .procname = "mmap_min_addr",
> >> - .data = &dac_mmap_min_addr,
> >> - .maxlen = sizeof(unsigned long),
> >> - .mode = 0644,
> >> - .proc_handler = mmap_min_addr_handler,
> >> - },
> >> -#endif
> >> #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
> >> (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
> >> {
> >> diff --git a/security/min_addr.c b/security/min_addr.c
> >> index 0ce267c041ab..b2f61649e110 100644
> >> --- a/security/min_addr.c
> >> +++ b/security/min_addr.c
> >> @@ -44,8 +44,19 @@ int mmap_min_addr_handler(const struct ctl_table *table, int write,
> >> return ret;
> >> }
> >>
> >> +static struct ctl_table min_addr_sysctl_table[] = {
> >> + {
> >> + .procname = "mmap_min_addr",
> >> + .data = &dac_mmap_min_addr,
> >> + .maxlen = sizeof(unsigned long),
> >> + .mode = 0644,
> >> + .proc_handler = mmap_min_addr_handler,
> >> + },
> >> +};
> >
> > I haven't chased all of the Kconfig deps to see if there is a problem,
> > but please provide a quick explanation in the commit description about
> > why it is okay to drop the CONFIG_MMU check.
>
> According to the compilation condition in security/Makefile:
>
> obj-$(CONFIG_MMU) += min_addr.o
>
> if CONFIG_MMU is not defined, min_addr.c would not be included in the
> compilation process.
> So,it is okay to drop the CONFIG_MMU check.
Great, please add some text about that in the commit description as it
is an important difference in the code changes that isn't currently
documented in the patch.
--
paul-moore.com
Powered by blists - more mailing lists