LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rich Felker <dalias@libc.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-sh@vger.kernel.org, catalin.marinas@arm.com,
	paulus@samba.org, ak@linux.intel.com, paulburton@kernel.org,
	geert@linux-m68k.org, mattst88@gmail.com, brgerst@gmail.com,
	acme@kernel.org, cyphar@cyphar.com, viro@zeniv.linux.org.uk,
	luto@kernel.org, tglx@linutronix.de, surenb@google.com,
	rth@twiddle.net, young.liuyang@huawei.com,
	linux-parisc@vger.kernel.org, rdunlap@infradead.org,
	linux-kernel@vger.kernel.org, mcgrof@kernel.org,
	linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org,
	mark.rutland@arm.com, linux-ia64@vger.kernel.org,
	linux-xtensa@linux-xtensa.org, jongk@linux-m68k.org,
	linux@dominikbrodowski.net,
	James.Bottomley@HansenPartnership.com, jcmvbkbc@gmail.com,
	linux-s390@vger.kernel.org, ysato@users.sourceforge.jp,
	deller@gmx.de, yzaikin@google.com,
	Xiaoming Ni <nixiaoming@huawei.com>,
	mszeredi@redhat.com, gor@linux.ibm.com,
	linux-alpha@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	linux-arm-kernel@lists.infradead.org, chris@zankel.net,
	tony.luck@intel.com, linux-api@vger.kernel.org,
	zhouyanjie@wanyeetech.com, minchan@kernel.org, sargun@sargun.me,
	alexander.shishkin@linux.intel.com, heiko.carstens@de.ibm.com,
	alex.huangjianhui@huawei.com, will@kernel.org, krzk@kernel.org,
	borntraeger@de.ibm.com, vbabka@suse.cz, samitolvanen@google.com,
	flameeyes@flameeyes.com, ravi.bangoria@linux.ibm.com,
	elver@google.com, keescook@chromium.org, arnd@arndb.de,
	bp@alien8.de, christian@brauner.io, tsbogend@alpha.franken.de,
	jiri@mellanox.com, martin.petersen@oracle.com,
	yamada.masahiro@socionext.com, oleg@redhat.com,
	sudeep.holla@arm.com, olof@lixom.net, shawnguo@kernel.org,
	davem@davemloft.net, bauerman@linux.ibm.com,
	fenghua.yu@intel.com, peterz@infradead.org, dhowells@redhat.com,
	hpa@zytor.com, sparclinux@vger.kernel.org, jolsa@redhat.com,
	svens@stackframe.org, x86@kernel.org, linux@armlinux.org.uk,
	mingo@redhat.com, naveen.n.rao@linux.vnet.ibm.com,
	paulmck@kernel.org, sfr@canb.auug.org.au, npiggin@gmail.com,
	namhyung@kernel.org, dvyukov@google.com, axboe@kernel.dk,
	monstr@monstr.eu, haolee.swjtu@gmail.com,
	linux-mips@vger.kernel.org, ink@jurassic.park.msu.ru,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] All arch: remove system call sys_sysctl
Date: Thu, 11 Jun 2020 13:20:28 -0400	[thread overview]
Message-ID: <20200611172028.GO1079@brightrain.aerifal.cx> (raw)
In-Reply-To: <87ftb1sfjc.fsf@x220.int.ebiederm.org>

On Thu, Jun 11, 2020 at 12:01:11PM -0500, Eric W. Biederman wrote:
> Rich Felker <dalias@libc.org> writes:
> 
> > On Thu, Jun 11, 2020 at 06:43:00AM -0500, Eric W. Biederman wrote:
> >> Xiaoming Ni <nixiaoming@huawei.com> writes:
> >> 
> >> > Since the commit 61a47c1ad3a4dc ("sysctl: Remove the sysctl system call"),
> >> > sys_sysctl is actually unavailable: any input can only return an error.
> >> >
> >> > We have been warning about people using the sysctl system call for years
> >> > and believe there are no more users.  Even if there are users of this
> >> > interface if they have not complained or fixed their code by now they
> >> > probably are not going to, so there is no point in warning them any
> >> > longer.
> >> >
> >> > So completely remove sys_sysctl on all architectures.
> >> 
> >> 
> >> 
> >> >
> >> > Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> >> >
> >> > changes in v2:
> >> >   According to Kees Cook's suggestion, completely remove sys_sysctl on all arch
> >> >   According to Eric W. Biederman's suggestion, update the commit log
> >> >
> >> > V1: https://lore.kernel.org/lkml/1591683605-8585-1-git-send-email-nixiaoming@huawei.com/
> >> >   Delete the code of sys_sysctl and return -ENOSYS directly at the function entry
> >> > ---
> >> >  include/uapi/linux/sysctl.h                        |  15 --
> >> [snip]
> >> 
> >> > diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
> >> > index 27c1ed2..84b44c3 100644
> >> > --- a/include/uapi/linux/sysctl.h
> >> > +++ b/include/uapi/linux/sysctl.h
> >> > @@ -27,21 +27,6 @@
> >> >  #include <linux/types.h>
> >> >  #include <linux/compiler.h>
> >> >  
> >> > -#define CTL_MAXNAME 10		/* how many path components do we allow in a
> >> > -				   call to sysctl?   In other words, what is
> >> > -				   the largest acceptable value for the nlen
> >> > -				   member of a struct __sysctl_args to have? */
> >> > -
> >> > -struct __sysctl_args {
> >> > -	int __user *name;
> >> > -	int nlen;
> >> > -	void __user *oldval;
> >> > -	size_t __user *oldlenp;
> >> > -	void __user *newval;
> >> > -	size_t newlen;
> >> > -	unsigned long __unused[4];
> >> > -};
> >> > -
> >> >  /* Define sysctl names first */
> >> >  
> >> >  /* Top-level names: */
> >> [snip]
> >> 
> >> The uapi header change does not make sense.  The entire point of the
> >> header is to allow userspace programs to be able to call sys_sysctl.
> >> It either needs to all stay or all go.
> >> 
> >> As the concern with the uapi header is about userspace programs being
> >> able to compile please leave the header for now.
> >> 
> >> We should leave auditing userspace and seeing if userspace code will
> >> still compile if we remove this header for a separate patch.  The
> >> concerns and justifications for the uapi header are completely different
> >> then for the removing the sys_sysctl implementation.
> >> 
> >> Otherwise
> >> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> >
> > The UAPI header should be kept because it's defining an API not just
> > for the kernel the headers are supplied with, but for all past
> > kernels. In particular programs needing a failsafe CSPRNG source that
> > works on old kernels may (do) use this as a fallback only if modern
> > syscalls are missing. Removing the syscall is no problem since it
> > won't be used, but if you remove the types/macros from the UAPI
> > headers, they'll have to copy that into their own sources.
> 
> May we assume you know of a least one piece of userspace that will fail
> to compile if this header file is removed?

I know at least one piece of software is using SYS_sysctl for a
fallback CSPRNG source. I'm not 100% sure that they're using the
kernel headers; they might have copied it already. I'm also not sure
how many there are.

Regardless, I think the principle stands. There's no need to remove
definitions that are essentially maintenance-free now that the
interface is no longer available in new kernels, and doing so
contributes to the myth that you're supposed to use kernel headers
matching runtime kernel rather than it always being safe to use latest
headers.

Rich

  reply	other threads:[~2020-06-11 21:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  3:54 [PATCH v2] All arch: remove system call sys_sysctl Xiaoming Ni
2020-06-11  4:12 ` Stephen Rothwell
2020-06-11  7:07 ` Will Deacon
2020-06-11 11:43 ` Eric W. Biederman
2020-06-11 16:39   ` Rich Felker
2020-06-11 17:01     ` Eric W. Biederman
2020-06-11 17:20       ` Rich Felker [this message]
2020-06-11 18:23         ` Eric W. Biederman
2020-06-12  9:48           ` Xiaoming Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611172028.GO1079@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.huangjianhui@huawei.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=bauerman@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=chris@zankel.net \
    --cc=christian@brauner.io \
    --cc=cyphar@cyphar.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=dhowells@redhat.com \
    --cc=dvyukov@google.com \
    --cc=ebiederm@xmission.com \
    --cc=elver@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=flameeyes@flameeyes.com \
    --cc=geert@linux-m68k.org \
    --cc=gor@linux.ibm.com \
    --cc=haolee.swjtu@gmail.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiri@mellanox.com \
    --cc=jolsa@redhat.com \
    --cc=jongk@linux-m68k.org \
    --cc=keescook@chromium.org \
    --cc=krzk@kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@dominikbrodowski.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.petersen@oracle.com \
    --cc=mattst88@gmail.com \
    --cc=mcgrof@kernel.org \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=monstr@monstr.eu \
    --cc=mszeredi@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=nixiaoming@huawei.com \
    --cc=npiggin@gmail.com \
    --cc=oleg@redhat.com \
    --cc=olof@lixom.net \
    --cc=paulburton@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=rdunlap@infradead.org \
    --cc=rth@twiddle.net \
    --cc=samitolvanen@google.com \
    --cc=sargun@sargun.me \
    --cc=sfr@canb.auug.org.au \
    --cc=shawnguo@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=surenb@google.com \
    --cc=svens@stackframe.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=young.liuyang@huawei.com \
    --cc=ysato@users.sourceforge.jp \
    --cc=yzaikin@google.com \
    --cc=zhouyanjie@wanyeetech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox