mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Indan Zupancic" <indan@nul.nu>
To: "Denys Vlasenko" <vda.linux@googlemail.com>
Cc: "Oleg Nesterov" <oleg@redhat.com>, "Tejun Heo" <tj@kernel.org>,
	linux-kernel@vger.kernel.org, dvlasenk@redhat.com,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: Re: [PATCH 1/2] ptrace: don't modify flags on PTRACE_SETOPTIONS failure
Date: Fri, 9 Sep 2011 14:44:57 +0200	[thread overview]
Message-ID: <2d14558326f860dea54093d31d1ba12f.squirrel@webmail.greenhost.nl> (raw)
In-Reply-To: <201109090824.37366.vda.linux@googlemail.com>

Hello,

On Fri, September 9, 2011 08:24, Denys Vlasenko wrote:
> It's very unlikely that there is userspace code in the wild which
> will be affected by this change: it should have the form
>
>     ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_BOGUSOPT)
>
> where PTRACE_O_BOGUSOPT is a constant unknown to the kernel.
> But kernel headers, naturally, don't contain any
> PTRACE_O_BOGUSOPTs, thus the only way userspace can use one
> if it defines one itself. I can't see why anyone would do such
> a thing deliberately.

The only realistic case is when a program compiled on a newer
kernel is run on an older kernel, when it does things like

#ifndef PTRACE_O_TRACEFORK
	opts |= PTRACE_O_TRACEFORK;
#endif

and happened to work on older kernels because it didn't check
the return value.

With the current options the program has to change its behaviour
depending whether the options are available or not, so no problems
should happen in practice, because if a program counts on any
options that didn't exist before, it won't work anyway.

Code that cares about backward compatibility will check at runtime
if the PTRACE_SETOPTIONS fails, and do a new one without the unknown
options.

So it's best to fix this behaviour before introducing new options
that are harmless if the setting of them fails.

Greetings,

Indan



  parent reply	other threads:[~2011-09-09 12:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09  6:22 [PATCH 0/2] Fixes and cleanups in PTRACE_SETOPTIONS Denys Vlasenko
2011-09-09  6:24 ` [PATCH 1/2] ptrace: don't modify flags on PTRACE_SETOPTIONS failure Denys Vlasenko
2011-09-09  6:29   ` [PATCH 2/2] ptrace: simplify PTRACE_foo constants and PTRACE_SETOPTIONS code Denys Vlasenko
2011-09-10 23:32     ` Tejun Heo
2011-09-09 12:44   ` Indan Zupancic [this message]
2011-09-09 12:58     ` [PATCH 1/2] ptrace: don't modify flags on PTRACE_SETOPTIONS failure Denys Vlasenko
2011-09-09 16:22       ` Indan Zupancic
2011-09-10 23:32   ` Tejun Heo
2011-09-09 15:28 ` [PATCH 0/2] Fixes and cleanups in PTRACE_SETOPTIONS Oleg Nesterov

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=2d14558326f860dea54093d31d1ba12f.squirrel@webmail.greenhost.nl \
    --to=indan@nul.nu \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vda.linux@googlemail.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

all inboxes | Powered by JetHome®