Index: kernel/generic/src/security/perm.c
===================================================================
--- kernel/generic/src/security/perm.c	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ kernel/generic/src/security/perm.c	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -131,5 +131,5 @@
 	 * doesn't have PERM_PERM.
 	 */
-	irq_spinlock_unlock(&TASK->lock, false);
+	irq_spinlock_lock(&TASK->lock, false);
 
 	if ((!(TASK->perms & PERM_PERM)) || (task != TASK)) {
Index: tools/xcw/bin/helenos-bld-config
===================================================================
--- tools/xcw/bin/helenos-bld-config	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ tools/xcw/bin/helenos-bld-config	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -47,4 +47,5 @@
 case ".$1" in
 (.--cc) extract_field "CC" "$MAKEFILE_COMMON";;
+(.--ld) extract_field "LD" "$MAKEFILE_COMMON";;
 (.--uarch) extract_field "UARCH" "$MAKEFILE_CONFIG";;
 (.--endian)
Index: tools/xcw/bin/helenos-ld
===================================================================
--- tools/xcw/bin/helenos-ld	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
+++ tools/xcw/bin/helenos-ld	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# Copyright (c) 2015 Jiri Svoboda
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Link editor (ld) wrapper
+# HelenOS Cross Compiler Wrapper (XCW)
+# Facilitate cross-compiling external software to HelenOS
+#
+
+XCW="$(dirname "$0")"
+SRC_ROOT="$XCW/../../.."
+UARCH="$("$XCW"/helenos-bld-config --uarch)"
+CC="$("$XCW"/helenos-bld-config --cc)"
+
+echo helenos-ld "$@"
+"$CC" \
+    "$@" \
+    "$SRC_ROOT"/uspace/lib/c/crt0.o \
+    "$SRC_ROOT"/uspace/lib/c/crt1.o \
+    "$SRC_ROOT"/uspace/lib/c/libc.a
Index: tools/xcw/demo/Makefile
===================================================================
--- tools/xcw/demo/Makefile	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ tools/xcw/demo/Makefile	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -43,5 +43,7 @@
 
 CC = helenos-cc
-CFLAGS = -std=gnu99 -Wall `helenos-pkg-config --cflags libgui libdraw libmath`
+LD = helenos-ld
+CFLAGS = -std=gnu11 -Wall `helenos-pkg-config --cflags libgui libdraw libmath` \
+    -D_HELENOS_SOURCE
 LIBS = `helenos-pkg-config --libs libgui libdraw libmath`
 output = viewer
@@ -55,5 +57,5 @@
 
 $(output): $(objects)
-	$(CC) -o $@ $^ $(LIBS)
+	$(LD) -o $@ $^ $(LIBS)
 
 %.o: %.c
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ uspace/lib/c/Makefile	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -194,4 +194,5 @@
 	test/stdio/scanf.c \
 	test/odict.c \
+	test/perm.c \
 	test/qsort.c \
 	test/sprintf.c \
Index: uspace/lib/c/include/string.h
===================================================================
--- uspace/lib/c/include/string.h	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ uspace/lib/c/include/string.h	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -36,5 +36,5 @@
 #define LIBC_STRING_H_
 
-#ifdef _HELENOS_SOURCE
+#if defined(_HELENOS_SOURCE) && !defined(_REALLY_WANT_STRING_H)
 #error Please use str.h and mem.h instead
 #endif
Index: uspace/lib/c/test/main.c
===================================================================
--- uspace/lib/c/test/main.c	(revision ef4218ffa80e581a90d36e6259ab052bb5dc2548)
+++ uspace/lib/c/test/main.c	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -37,4 +37,5 @@
 PCUT_IMPORT(mem);
 PCUT_IMPORT(odict);
+PCUT_IMPORT(perm);
 PCUT_IMPORT(qsort);
 PCUT_IMPORT(scanf);
Index: uspace/lib/c/test/perm.c
===================================================================
--- uspace/lib/c/test/perm.c	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
+++ uspace/lib/c/test/perm.c	(revision 1a5fe4f3ec6a76ebd5b30f992574d843540f25cb)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <task.h>
+#include <pcut/pcut.h>
+#include <perm.h>
+
+PCUT_INIT;
+
+PCUT_TEST_SUITE(perm);
+
+PCUT_TEST(revoke)
+{
+	errno_t rc = perm_revoke(task_get_id(), 0xf); // XXX Need PERM_xxx
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+}
+
+PCUT_EXPORT(perm);
