Linux Serial subsystem development
 help / color / mirror / Atom feed
From: nicolas.bouchinet@clip-os.org
To: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Cc: nicolas.bouchinet@clip-os.org,
	Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Luis Chamberlain <mcgrof@kernel.org>, Kees Cook <kees@kernel.org>,
	Joel Granados <j.granados@samsung.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lin Feng <linf@wangsu.com>, "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH 0/3] Fixes multiple sysctl proc_handler usage error
Date: Tue, 12 Nov 2024 14:13:28 +0100	[thread overview]
Message-ID: <20241112131357.49582-1-nicolas.bouchinet@clip-os.org> (raw)

From: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>

Hi, while reading sysctl code I encountered two sysctl proc_handler
parameters common errors.

The first one is to declare .data as a different type thant the return of
the used .proc_handler, i.e. using proch_dointvec, thats convert a char
string to signed integers, and storing the result in a .data that is backed
by an unsigned int. User can then write "-1" string, which results in a
different value stored in the .data variable. This can lead to type
conversion errors in branches and thus to potential security issues.

From a quick search using regex and only for proc_dointvec, this seems to
be a pretty common mistake.

The second one is to declare .extra1 or .extra2 values with a .proc_handler
that don't uses them. i.e, declaring .extra1 or .extra2 using proc_dointvec
in order to declare conversion bounds do not work as do_proc_dointvec don't
uses those variables if not explicitly asked.

This patchset corrects three sysctl declaration that are buggy as an
example and is not exhaustive.

Nicolas

Nicolas Bouchinet (3):
  coredump: Fixes core_pipe_limit sysctl proc_handler
  sysctl: Fix underflow value setting risk in vm_table
  tty: ldsic: fix tty_ldisc_autoload sysctl's proc_handler

 drivers/tty/tty_io.c | 2 +-
 fs/coredump.c        | 7 +++++--
 kernel/sysctl.c      | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.47.0


             reply	other threads:[~2024-11-12 13:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 13:13 nicolas.bouchinet [this message]
2024-11-12 13:13 ` [PATCH 1/3] coredump: Fixes core_pipe_limit sysctl proc_handler nicolas.bouchinet
2024-11-13  2:35   ` Lin Feng
2024-11-13 14:15     ` Nicolas Bouchinet
2024-11-14  1:34       ` Lin Feng
2024-11-14 14:25         ` Nicolas Bouchinet
2024-11-12 13:13 ` [PATCH 2/3] sysctl: Fix underflow value setting risk in vm_table nicolas.bouchinet
2024-11-13  2:37   ` Lin Feng
2024-11-12 13:13 ` [PATCH 3/3] tty: ldsic: fix tty_ldisc_autoload sysctl's proc_handler nicolas.bouchinet
2024-11-13  2:39   ` Lin Feng
2024-11-13  9:08   ` Jiri Slaby

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=20241112131357.49582-1-nicolas.bouchinet@clip-os.org \
    --to=nicolas.bouchinet@clip-os.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.granados@samsung.com \
    --cc=jack@suse.cz \
    --cc=jirislaby@kernel.org \
    --cc=kees@kernel.org \
    --cc=linf@wangsu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=nicolas.bouchinet@ssi.gouv.fr \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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