gecko-dev/security
Nathan Froyd e1d8b92ec6 Bug 1255425 - part 2 - pack kSTSPreloadList into a more efficient format; r=keeler
Entries in kSTSPreloadList currently look like:

class nsSTSPreload
{
  public:
    const char *mHost;
    const bool mIncludeSubdomains;
};

This is inefficient for a couple of reasons:

* The structure has a bunch of wasted space: it takes 8 bytes on 32-bit
  platforms and 16 bytes on 64-bit platforms, even though it only uses 5
  and 9 bytes, respectively.

* The |const char*| requires additional space in the form of relocations
  (at least on Linux/Android), which doubles the space cost of
  individual entries.  (The space cost of the relocations is mitigated
  somewhat on Linux and Android because of elfhack, but there's still
  extra cost in the on-disk format and during the load of libxul to
  process those relocations.)

* The relocations the structure requires means that the data in it can't
  be shared between processes, which is important for e10s with multiple
  content processes.

We can make it more efficient by structuring it like so:

static const char kSTSPreloadHosts[] = {
  // One giant character array containing the hosts, in order:
  //   "example.com\0example.org\0example.test\0..."
  // Use an array rather than a literal string due to compiler limitations.
};

struct nsSTSPreload
{
  // An index into kSTSPreloadHosts for the hostname.
  uint32_t mHostIndex: 31;
  // We use the same datatype for both members so that MSVC will pack
  // the bitfields into a single uint32_t.
  uint32_t mIncludeSubdomains: 1;
};

nsSTSPreload now has no wasted space and is significantly smaller,
especially on 64-bit platforms (saves ~29K on 32-bit platforms and ~85K
on 64-bit platforms).  This organization does add a couple extra
operations to searching for preload list entries, depending on your
platform, but the space savings make it worth it.
2016-03-24 15:09:28 -04:00
..
apps Bug 1219482: Replace PRLogModuleInfo with LazyLogModule in security subdirectory.r=nfroyd 2016-01-28 10:36:00 -08:00
certverifier Bug 1004149 - Return mozilla::pkix::Result values in nsNSSHttpInterface functions. r=keeler 2016-03-18 21:11:03 -07:00
manager Bug 1255425 - part 2 - pack kSTSPreloadList into a more efficient format; r=keeler 2016-03-24 15:09:28 -04:00
nss Bug 1245053, NSS_3_23_RTM, only version numbers finalized, no code changes, DONTBUILD 2016-03-03 10:53:54 +01:00
patches Bug 1137470, remove the documentation patch file, because it's no longer reverted locally, DONTBUILD 2015-03-20 13:38:13 +01:00
pkix bug 1258579 - remove some unnecessary time-related globals from mozilla::pkix tests r=Cykesiopka 2016-03-22 10:26:30 -07:00
sandbox Bug 1124033 - Disable C4311 and C4312 in directories exhibiting warnings; r=ehsan 2016-03-23 17:19:20 -07:00