1 --- a/src/tspi/tsp_policy.c 2010-05-01 19:39:11.000000000 -0700
2 +++ b/src/tspi/tsp_policy.c 2012-04-20 18:10:16.757128000 -0700
5 pin_mem(void *addr, size_t len)
7 - /* only root can lock pages into RAM */
8 - if (getuid() != (uid_t)0) {
9 - LogWarn("Not pinning secrets in memory due to insufficient perms.");
13 len += (uintptr_t)addr & PGOFFSET;
14 addr = (void *)((uintptr_t)addr & PGMASK);
15 if (mlock(addr, len) == -1) {
16 + if (errno == EPERM) {
17 + LogWarn("Not pinning secrets in memory due to insufficient perms.");
20 LogError("mlock: %s", strerror(errno));
25 unpin_mem(void *addr, size_t len)
27 - /* only root can lock pages into RAM */
28 - if (getuid() != (uid_t)0) {
32 len += (uintptr_t)addr & PGOFFSET;
33 addr = (void *)((uintptr_t)addr & PGMASK);
34 if (munlock(addr, len) == -1) {
35 + if (errno == EPERM) {
38 LogError("mlock: %s", strerror(errno));