All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one
@ 2017-02-04  8:20 shqking
  2017-02-06 10:26 ` [Qemu-devel] [Bug 1661815] " Thomas Huth
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: shqking @ 2017-02-04  8:20 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

The vulnerable version is qemu-2.8.0, and the vulnerable function is in
"target-s390x/translate.c".

The code snippet is as following.

static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
{
    const DisasInsn *insn;
    ExitStatus ret = NO_EXIT;
    DisasFields f;
    ...
    s->fields = &f;
    ...
    s->pc = s->next_pc;
    return ret;
}

A stack address, i.e. the address of local variable "f" is returned from
current function through the output parameter "s->fields" as a side
effect.

This issue is one kind of undefined behaviors, according the C Standard,
6.2.4 [ISO/IEC 9899:2011]
(https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

This dangerous defect may lead to an exploitable vulnerability.
We suggest sanitizing "s->fields" as null before return.

Note that this issue is reported by shqking and Zhenwei Zou together.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  New

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1661815] Re: Stack address is returned from function translate_one
  2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
@ 2017-02-06 10:26 ` Thomas Huth
  2017-02-06 12:17 ` shqking
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2017-02-06 10:26 UTC (permalink / raw)
  To: qemu-devel

The calling function never uses "->fields", so I do not see a real
vulnerability here, is there? Did you use a code analyser for this, or
how did you come across this issue?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  New

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1661815] Re: Stack address is returned from function translate_one
  2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
  2017-02-06 10:26 ` [Qemu-devel] [Bug 1661815] " Thomas Huth
@ 2017-02-06 12:17 ` shqking
  2020-01-23 11:11 ` Thomas Huth
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: shqking @ 2017-02-06 12:17 UTC (permalink / raw)
  To: qemu-devel

Thanks for your reply.

Inspired by this issue in apache httpd (https://bz.apache.org/bugzilla/show_bug.cgi?id=59844#c0),
we customized a checker based on the Clang Static Analyzer to detect such undefined behavior.

Yes. 
After examining the code carefully, we didn't find any place where the "->fields" is accessed, either. However, we think this kind of defect seems like a 'time bomb' and we'd better fix it just to be on the safe side.

** Bug watch added: bz.apache.org/bugzilla/ #59844
   https://bz.apache.org/bugzilla/show_bug.cgi?id=59844

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  New

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1661815] Re: Stack address is returned from function translate_one
  2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
  2017-02-06 10:26 ` [Qemu-devel] [Bug 1661815] " Thomas Huth
  2017-02-06 12:17 ` shqking
@ 2020-01-23 11:11 ` Thomas Huth
  2020-02-11 14:34 ` Thomas Huth
  2020-04-30 13:27 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2020-01-23 11:11 UTC (permalink / raw)
  To: qemu-devel

I've finally posted a patch for this:
https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg05204.html

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  New

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1661815] Re: Stack address is returned from function translate_one
  2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
                   ` (2 preceding siblings ...)
  2020-01-23 11:11 ` Thomas Huth
@ 2020-02-11 14:34 ` Thomas Huth
  2020-04-30 13:27 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2020-02-11 14:34 UTC (permalink / raw)
  To: qemu-devel

Fixed here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=344a7f656e8d211cdd6e

** Changed in: qemu
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  Fix Committed

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1661815] Re: Stack address is returned from function translate_one
  2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
                   ` (3 preceding siblings ...)
  2020-02-11 14:34 ` Thomas Huth
@ 2020-04-30 13:27 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2020-04-30 13:27 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1661815

Title:
  Stack address is returned from function translate_one

Status in QEMU:
  Fix Released

Bug description:
  The vulnerable version is qemu-2.8.0, and the vulnerable function is
  in "target-s390x/translate.c".

  The code snippet is as following.

  static ExitStatus translate_one(CPUS390XState *env, DisasContext *s)
  {
      const DisasInsn *insn;
      ExitStatus ret = NO_EXIT;
      DisasFields f;
      ...
      s->fields = &f;
      ...
      s->pc = s->next_pc;
      return ret;
  }

  A stack address, i.e. the address of local variable "f" is returned
  from current function through the output parameter "s->fields" as a
  side effect.

  This issue is one kind of undefined behaviors, according the C
  Standard, 6.2.4 [ISO/IEC 9899:2011]
  (https://www.securecoding.cert.org/confluence/display/c/DCL30-C.+Declare+objects+with+appropriate+storage+durations)

  This dangerous defect may lead to an exploitable vulnerability.
  We suggest sanitizing "s->fields" as null before return.

  Note that this issue is reported by shqking and Zhenwei Zou together.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1661815/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-30 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-04  8:20 [Qemu-devel] [Bug 1661815] [NEW] Stack address is returned from function translate_one shqking
2017-02-06 10:26 ` [Qemu-devel] [Bug 1661815] " Thomas Huth
2017-02-06 12:17 ` shqking
2020-01-23 11:11 ` Thomas Huth
2020-02-11 14:34 ` Thomas Huth
2020-04-30 13:27 ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.