gcc-6: don't ship info pages
[unleashed-userland.git] / components / trousers / patches / tspi_tsp_policy.c.patch
blobc1a322e8ba1300c89447955c3349f1ffe99b7f06
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
3 @@ -86,15 +86,13 @@
4 int
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.");
10 - return 0;
11 - }
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.");
18 + return 0;
19 + }
20 LogError("mlock: %s", strerror(errno));
21 return 1;
23 @@ -105,14 +103,12 @@
24 int
25 unpin_mem(void *addr, size_t len)
27 - /* only root can lock pages into RAM */
28 - if (getuid() != (uid_t)0) {
29 - return 0;
30 - }
32 len += (uintptr_t)addr & PGOFFSET;
33 addr = (void *)((uintptr_t)addr & PGMASK);
34 if (munlock(addr, len) == -1) {
35 + if (errno == EPERM) {
36 + return 0;
37 + }
38 LogError("mlock: %s", strerror(errno));
39 return 1;