Don't chmod 777 *all* of /dev/shm; just the dir.

Since we bind mount /run/shm (or /dev/shm), treat it like a shared
resource by not changing the permissions of all of its contents.

BUG=None
TEST=cros_sdk
Change-Id: I86735189e903f258704c2704d497eb1ea969f431
Reviewed-on: https://chromium-review.googlesource.com/337321
Commit-Ready: Josh McSavaney <mcsaucy@google.com>
Tested-by: Josh McSavaney <mcsaucy@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index 0ddb7ce..c0dc589 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -502,8 +502,9 @@
     promote_api_keys
 
     # Fix permissions on shared memory to allow non-root users access to POSIX
-    # semaphores.
-    chmod -R 777 "${FLAGS_chroot}/dev/shm"
+    # semaphores. Take special care to only change the permissions on the
+    # directory and not all of its contents.
+    chmod 1777 "${FLAGS_chroot}/dev/shm"
 
     # gsutil uses boto config to store settings and credentials. Copy
     # user's own boto file into the chroot if it exists. Also copy it