~ubuntu-branches/ubuntu/wily/clamav/wily-proposed

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/CodeGen/PseudoSourceValue.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Sebastian Andrzej Siewior, Andreas Cadhalpun, Scott Kitterman, Javier Fernández-Sanguino
  • Date: 2015-01-28 00:25:13 UTC
  • mfrom: (0.48.14 sid)
  • Revision ID: package-import@ubuntu.com-20150128002513-lil2oi74cooy4lzr
Tags: 0.98.6+dfsg-1
[ Sebastian Andrzej Siewior ]
* update "fix-ssize_t-size_t-off_t-printf-modifier", include of misc.h was
  missing but was pulled in via the systemd patch.
* Don't leak return codes from libmspack to clamav API. (Closes: #774686).

[ Andreas Cadhalpun ]
* Add patch to avoid emitting incremental progress messages when not
  outputting to a terminal. (Closes: #767350)
* Update lintian-overrides for unused-file-paragraph-in-dep5-copyright.
* clamav-base.postinst: always chown /var/log/clamav and /var/lib/clamav
  to clamav:clamav, not only on fresh installations. (Closes: #775400)
* Adapt the clamav-daemon and clamav-freshclam logrotate scripts,
  so that they correctly work under systemd.
* Move the PidFile variable from the clamd/freshclam configuration files
  to the init scripts. This makes the init scripts more robust against
  misconfiguration and avoids error messages with systemd. (Closes: #767353)
* debian/copyright: drop files from Files-Excluded only present in github
  tarballs
* Drop Workaround-a-bug-in-libc-on-Hurd.patch, because hurd got fixed.
  (see #752237)
* debian/rules: Remove useless --with-system-tommath --without-included-ltdl
  configure options.

[ Scott Kitterman ]
* Stop stripping llvm when repacking the tarball as the system llvm on some
  releases is too old to use
* New upstream bugfix release
  - Library shared object revisions.
  - Includes a patch from Sebastian Andrzej Siewior making ClamAV pid files
    compatible with systemd.
  - Fix a heap out of bounds condition with crafted Yoda's crypter files.
    This issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted mew packer files. This
    issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted upx packer files. This
    issue was discovered by Kevin Szkudlapski of Quarkslab.
  - Fix a heap out of bounds condition with crafted upack packer files. This
    issue was discovered by Sebastian Andrzej Siewior. CVE-2014-9328.
  - Compensate a crash due to incorrect compiler optimization when handling
    crafted petite packer files. This issue was discovered by Sebastian
    Andrzej Siewior.
* Update lintian override for embedded zlib to match new so version

[ Javier Fernández-Sanguino ]
* Updated Spanish Debconf template translation (Closes: #773563)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===-- llvm/CodeGen/PseudoSourceValue.cpp ----------------------*- C++ -*-===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// This file implements the PseudoSourceValue class.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#include "llvm/CodeGen/MachineFrameInfo.h"
 
15
#include "llvm/CodeGen/PseudoSourceValue.h"
 
16
#include "llvm/DerivedTypes.h"
 
17
#include "llvm/LLVMContext.h"
 
18
#include "llvm/Support/ErrorHandling.h"
 
19
#include "llvm/Support/ManagedStatic.h"
 
20
#include "llvm/Support/raw_ostream.h"
 
21
#include "llvm/System/Mutex.h"
 
22
#include <map>
 
23
using namespace llvm;
 
24
 
 
25
namespace {
 
26
struct PSVGlobalsTy {
 
27
  // PseudoSourceValues are immutable so don't need locking.
 
28
  const PseudoSourceValue PSVs[4];
 
29
  sys::Mutex Lock;  // Guards FSValues, but not the values inside it.
 
30
  std::map<int, const PseudoSourceValue *> FSValues;
 
31
 
 
32
  PSVGlobalsTy() : PSVs() {}
 
33
  ~PSVGlobalsTy() {
 
34
    for (std::map<int, const PseudoSourceValue *>::iterator
 
35
           I = FSValues.begin(), E = FSValues.end(); I != E; ++I) {
 
36
      delete I->second;
 
37
    }
 
38
  }
 
39
};
 
40
 
 
41
static ManagedStatic<PSVGlobalsTy> PSVGlobals;
 
42
 
 
43
}  // anonymous namespace
 
44
 
 
45
const PseudoSourceValue *PseudoSourceValue::getStack()
 
46
{ return &PSVGlobals->PSVs[0]; }
 
47
const PseudoSourceValue *PseudoSourceValue::getGOT()
 
48
{ return &PSVGlobals->PSVs[1]; }
 
49
const PseudoSourceValue *PseudoSourceValue::getJumpTable()
 
50
{ return &PSVGlobals->PSVs[2]; }
 
51
const PseudoSourceValue *PseudoSourceValue::getConstantPool()
 
52
{ return &PSVGlobals->PSVs[3]; }
 
53
 
 
54
static const char *const PSVNames[] = {
 
55
  "Stack",
 
56
  "GOT",
 
57
  "JumpTable",
 
58
  "ConstantPool"
 
59
};
 
60
 
 
61
// FIXME: THIS IS A HACK!!!!
 
62
// Eventually these should be uniqued on LLVMContext rather than in a managed
 
63
// static.  For now, we can safely use the global context for the time being to
 
64
// squeak by.
 
65
PseudoSourceValue::PseudoSourceValue(enum ValueTy Subclass) :
 
66
  Value(Type::getInt8PtrTy(getGlobalContext()),
 
67
        Subclass) {}
 
68
 
 
69
void PseudoSourceValue::printCustom(raw_ostream &O) const {
 
70
  O << PSVNames[this - PSVGlobals->PSVs];
 
71
}
 
72
 
 
73
const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) {
 
74
  PSVGlobalsTy &PG = *PSVGlobals;
 
75
  sys::ScopedLock locked(PG.Lock);
 
76
  const PseudoSourceValue *&V = PG.FSValues[FI];
 
77
  if (!V)
 
78
    V = new FixedStackPseudoSourceValue(FI);
 
79
  return V;
 
80
}
 
81
 
 
82
bool PseudoSourceValue::isConstant(const MachineFrameInfo *) const {
 
83
  if (this == getStack())
 
84
    return false;
 
85
  if (this == getGOT() ||
 
86
      this == getConstantPool() ||
 
87
      this == getJumpTable())
 
88
    return true;
 
89
  llvm_unreachable("Unknown PseudoSourceValue!");
 
90
  return false;
 
91
}
 
92
 
 
93
bool PseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
 
94
  if (this == getStack() ||
 
95
      this == getGOT() ||
 
96
      this == getConstantPool() ||
 
97
      this == getJumpTable())
 
98
    return false;
 
99
  llvm_unreachable("Unknown PseudoSourceValue!");
 
100
  return true;
 
101
}
 
102
 
 
103
bool PseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
 
104
  if (this == getGOT() ||
 
105
      this == getConstantPool() ||
 
106
      this == getJumpTable())
 
107
    return false;
 
108
  return true;
 
109
}
 
110
 
 
111
bool FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const{
 
112
  return MFI && MFI->isImmutableObjectIndex(FI);
 
113
}
 
114
 
 
115
bool FixedStackPseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
 
116
  // Negative frame indices are used for special things that don't
 
117
  // appear in LLVM IR. Non-negative indices may be used for things
 
118
  // like static allocas.
 
119
  if (!MFI)
 
120
    return FI >= 0;
 
121
  // Spill slots should not alias others.
 
122
  return !MFI->isFixedObjectIndex(FI) && !MFI->isSpillSlotObjectIndex(FI);
 
123
}
 
124
 
 
125
bool FixedStackPseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
 
126
  if (!MFI)
 
127
    return true;
 
128
  // Spill slots will not alias any LLVM IR value.
 
129
  return !MFI->isSpillSlotObjectIndex(FI);
 
130
}
 
131
 
 
132
void FixedStackPseudoSourceValue::printCustom(raw_ostream &OS) const {
 
133
  OS << "FixedStack" << FI;
 
134
}