* Re: [PATCH net-next 3/7] bpf: add array type of eBPF maps
From: Alexei Starovoitov @ 2014-11-04 23:14 UTC (permalink / raw)
To: Daniel Borkmann
Cc: David S. Miller, Ingo Molnar, Andy Lutomirski,
Hannes Frederic Sowa, Eric Dumazet, Linux API,
Network Development, LKML
In-Reply-To: <5458A349.5020401@redhat.com>
On Tue, Nov 4, 2014 at 1:58 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
>> +
>> + memcpy(array->value + array->elem_size * index, value,
>> array->elem_size);
>
> What would protect this from concurrent updates?
nothing.
that's what I meant in commit log:
- map_update_elem() replaces elements in an non-atomic way
(for atomic updates hashtable type should be used instead)
The array map is like C array of structures.
Nothing protects concurrent access.
It's used in the cases where accuracy is not needed
or when there is no concurrent access.
To compute a histogram of events in tracing the array
of integers is used. Every integer is a counter. Program
increments it (may be without using xadd) and
user space periodically reads it back.
map_update_elem() is called by userspace once
to initialize it if zero-init is not enough.
Programs do lookup() and modify the values.
For array type update() method is used rarely,
delete() is never used and get_next() is needed
for completeness to browse maps through
common map API.
I'm guessing you're asking, because it may feel
that adding a lock() will help to make it more useful? ;)
It's not, since programs cannot take a lock().
^ permalink raw reply
* Re: [PATCH net-next 6/7] bpf: allow eBPF programs to use maps
From: Alexei Starovoitov @ 2014-11-04 23:08 UTC (permalink / raw)
To: Daniel Borkmann
Cc: David S. Miller, Ingo Molnar, Andy Lutomirski,
Hannes Frederic Sowa, Eric Dumazet, Linux API,
Network Development, LKML
In-Reply-To: <5458A17B.7030904@redhat.com>
On Tue, Nov 4, 2014 at 1:50 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
> These WARN_ON_ONCE(!rcu_read_lock_held()) seem odd. While I see the point
> that
> you're holding RCU read lock on the lookup, can you elaborate on your RCU
> usage
> here and why it's necessary for delete/update?
>
> I suspect due to the synchronize_rcu() you're using and not using any RCU
> accessors but plain memcpy() e.g. in case of the array ...?
Correct in case of array.
Also hash delete/update() call into lookup() internally
that is using _rcu() helpers...
Future map types might have much more
complex implementations (like LPM), so it helps
to state the rules early.
Another reason is more complex to explain:
A program that intends to access maps has to be one
rcu critical section. So all lookup/update/delete calls
are under rcu_lock_held.
Since programs by themselves cannot have WARN_ON
inside them, I've added WARN_ON in these three
functions that will be called from the programs to make
sure that kernel subsystems don't do (*prog->bpf_func)(...)
without taking rcu_lock if they intend to let programs
access maps.
Having said that in the future we might have a case
for programs that don't call into these functions at all
and execute instructions only. Those won't need
rcu_lock() wrap. I experimented with that for the
patch where I replaced pred-tree walker with eBPF
program. There is no rcu there. And no calls
to map accessors.
Has to be noted, that socket filters use rcu to
protect sk_filter pointer and program itself. So for that
use case we'll keep using rcu for foreseeable future.
For tracing filters I had to add rcu_lock() around
BPF_PROG_RUN() invocation and these WARN_ON
checks saved me a lot of headache, so I prefer to
keep them since they cost nothing when lockdep is off.
^ permalink raw reply
* Re: [PATCH net-next 1/7] bpf: add 'flags' attribute to BPF_MAP_UPDATE_ELEM command
From: Alexei Starovoitov @ 2014-11-04 23:04 UTC (permalink / raw)
To: Daniel Borkmann
Cc: David S. Miller, Ingo Molnar, Andy Lutomirski,
Hannes Frederic Sowa, Eric Dumazet, Linux API,
Network Development, LKML
In-Reply-To: <54589B89.5000309-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Tue, Nov 4, 2014 at 1:25 AM, Daniel Borkmann <dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> On 11/04/2014 03:54 AM, Alexei Starovoitov wrote:
>>
>> the current meaning of BPF_MAP_UPDATE_ELEM syscall command is:
>> either update existing map element or create a new one.
>> Initially the plan was to add a new command to handle the case of
>> 'create new element if it didn't exist', but 'flags' style looks
>> cleaner and overall diff is much smaller (more code reused), so add 'flags'
>> attribute to BPF_MAP_UPDATE_ELEM command with the following meaning:
>> enum {
>> BPF_MAP_UPDATE_OR_CREATE = 0, /* add new element or update existing */
>> BPF_MAP_CREATE_ONLY, /* add new element if it didn't exist */
>> BPF_MAP_UPDATE_ONLY /* update existing element */
>> };
>
>
> From you commit message/code I currently don't see an explanation why
> it cannot be done in typical ``flags style'' as various syscalls do,
> i.e. BPF_MAP_UPDATE_OR_CREATE rather represented as ...
>
> BPF_MAP_CREATE | BPF_MAP_UPDATE
>
> Do you expect more than 64 different flags to be passed from user space
> for BPF_MAP?
several reasons:
- preserve flags==0 as default behavior
- avoid holes and extra checks for invalid combinations, so
if (flags > BPF_MAP_UPDATE_ONLY) goto err, is enough.
- it looks much neater when user space uses
BPF_MAP_UPDATE_OR_CREATE instead of ORing bits.
Note this choice doesn't prevent adding bit-like flags
in the future. Today I cannot think of any new flags
for the update() command, but if somebody comes up with
a new selector that can apply to all three combinations,
we can add it as 3rd bit that can be ORed.
Default will stay zero and 'if >' check in older
kernels will seamlessly work with new userspace.
I don't like holes in flags and combinatorial
explosion of bits and checks for them unless
absolutely necessary.
^ permalink raw reply
* Re: [PATCH 02/20] selftests/net: move test out of Makefile into a shell script
From: David Miller @ 2014-11-04 19:53 UTC (permalink / raw)
To: shuahkh
Cc: gregkh, akpm, mmarek, keescook, tranmanphong, dh.herrmann, hughd,
bobby.prani, ebiederm, serge.hallyn, linux-kbuild, linux-kernel,
linux-api, netdev
In-Reply-To: <51d57725e89809806bd8af5555af341296cc4dd7.1415117102.git.shuahkh@osg.samsung.com>
From: Shuah Khan <shuahkh@osg.samsung.com>
Date: Tue, 4 Nov 2014 10:10:58 -0700
> Currently bpf test run from the Makefile. Move it out of the
> Makefile to be run from a shell script to allow the test to
> be run as stand-alone test, in addition to allowing the test
> run from a make target.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH 00/20] kselftest install target feature
From: Kees Cook @ 2014-11-04 19:22 UTC (permalink / raw)
To: Shuah Khan
Cc: Greg KH, Andrew Morton, Michal Marek, David S. Miller,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w, David Herrmann, Hugh Dickins,
bobby.prani-Re5JQEeQqe8AvxtiuMwx3w, Eric W. Biederman,
Serge E. Hallyn, linux-kbuild, LKML, Linux API,
Network Development
In-Reply-To: <cover.1415117102.git.shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
On Tue, Nov 4, 2014 at 9:10 AM, Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> wrote:
> This patch series adds a new kselftest_install make target
> to enable selftest install. When make kselftest_install is
> run, selftests are installed on the system. A new install
> target is added to selftests Makefile which will install
> targets for the tests that are specified in INSTALL_TARGETS.
> During install, a script is generated to run tests that are
> installed. This script will be installed in the selftest install
> directory. Individual test Makefiles are changed to add to the
> script. This will allow new tests to add install and run test
> commands to the generated kselftest script.
I'm all for making the self tests more available, but I don't think
this is the right approach. My primary objection is that it creates a
second way to run tests, and that means any changes and additions need
to be updated in two places. I'd much rather just maintain the single
"make" targets instead. Having "make" available on the target device
doesn't seem too bad to me. Is there a reason that doesn't work for
your situation?
I would, however, like to see some better standardization of the test
"framework" that we've got in there already. (For example, some
failures fail the "make", some don't, there are various reporting
methods for success/failure depending on the test, etc.)
-Kees
> Approach:
>
> make kselftest_target:
> -- exports kselftest INSTALL_KSFT_PATH
> default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
> -- exports path for ksefltest.sh
> -- runs selftests make install target:
>
> selftests make install target
> -- creates kselftest.sh script in install install dir
> -- runs install targets for all INSTALL_TARGETS
>
> Individual test make install targets:
> -- install test programs and/or scripts in install dir
> -- append to the ksefltest.sh file to add commands to run test
>
> Shuah Khan (20):
> selftests/user: move test out of Makefile into a shell script
> selftests/net: move test out of Makefile into a shell script
> kbuild: kselftest_install - add a new make target to install selftests
> selftests: add install target to enable installing selftests
> selftests/breakpoints: add install target to enable installing test
> selftests/cpu-hotplug: add install target to enable installing test
> selftests/efivarfs: add install target to enable installing test
> selftests/firmware: add install target to enable installing test
> selftests/ipc: add install target to enable installing test
> selftests/kcmp: add install target to enable installing test
> selftests/memfd: add install target to enable installing test
> selftests/memory-hotplug: add install target to enable installing test
> selftests/mount: add install target to enable installing test
> selftests/mqueue: add install target to enable installing test
> selftests/net: add install target to enable installing test
> selftests/ptrace: add install target to enable installing test
> selftests/sysctl: add install target to enable installing test
> selftests/timers: add install target to enable installing test
> selftests/vm: add install target to enable installing test
> selftests/user: add install target to enable installing test
>
> Makefile | 17 +++++++++++++++++
> tools/testing/selftests/Makefile | 14 ++++++++++++++
> tools/testing/selftests/breakpoints/Makefile | 12 ++++++++++++
> tools/testing/selftests/cpu-hotplug/Makefile | 9 +++++++++
> tools/testing/selftests/efivarfs/Makefile | 13 ++++++++++++-
> tools/testing/selftests/firmware/Makefile | 20 ++++++++++++++++++++
> tools/testing/selftests/ipc/Makefile | 11 +++++++++++
> tools/testing/selftests/kcmp/Makefile | 12 ++++++++++++
> tools/testing/selftests/memfd/Makefile | 10 ++++++++++
> tools/testing/selftests/memory-hotplug/Makefile | 9 +++++++++
> tools/testing/selftests/mount/Makefile | 7 +++++++
> tools/testing/selftests/mqueue/Makefile | 8 ++++++++
> tools/testing/selftests/net/Makefile | 18 +++++++++++-------
> tools/testing/selftests/net/test_bpf.sh | 10 ++++++++++
> tools/testing/selftests/ptrace/Makefile | 11 +++++++++--
> tools/testing/selftests/sysctl/Makefile | 10 ++++++++++
> tools/testing/selftests/timers/Makefile | 7 +++++++
> tools/testing/selftests/user/Makefile | 15 ++++++++-------
> tools/testing/selftests/user/test_user_copy.sh | 10 ++++++++++
> tools/testing/selftests/vm/Makefile | 7 +++++++
> 20 files changed, 213 insertions(+), 17 deletions(-)
> create mode 100755 tools/testing/selftests/net/test_bpf.sh
> create mode 100755 tools/testing/selftests/user/test_user_copy.sh
>
> --
> 1.9.1
>
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* [PATCH] bridge: include in6.h in if_bridge.h for struct in6_addr
From: Gregory Fong @ 2014-11-04 19:21 UTC (permalink / raw)
To: netdev
Cc: linux-api, linux-kernel, carlos, eblake, Kumar Gala, Gregory Fong,
Florian Fainelli, Cong Wang, David Miller
if_bridge.h uses struct in6_addr ip6, but wasn't including the in6.h
header. Thomas Backlund originally sent a patch to do this, but this
revealed a redefinition issue: https://lkml.org/lkml/2013/1/13/116
The redefinition issue should have been fixed by the following Linux
commits:
ee262ad827f89e2dc7851ec2986953b5b125c6bc inet: defines IPPROTO_* needed for module alias generation
cfd280c91253cc28e4919e349fa7a813b63e71e8 net: sync some IP headers with glibc
and the following glibc commit:
6c82a2f8d7c8e21e39237225c819f182ae438db3 Coordinate IPv6 definitions for Linux and glibc
so actually include the header now.
Reported-by: Colin Guthrie <colin@mageia.org>
Reported-by: Christiaan Welvaart <cjw@daneel.dyndns.org>
Reported-by: Thomas Backlund <tmb@mageia.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
---
include/uapi/linux/if_bridge.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 39f621a..da17e45 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -15,6 +15,7 @@
#include <linux/types.h>
#include <linux/if_ether.h>
+#include <linux/in6.h>
#define SYSFS_BRIDGE_ATTR "bridge"
#define SYSFS_BRIDGE_FDB "brforward"
--
1.9.1
^ permalink raw reply related
* Re: [PATCHv2 2/3] selftests: Add test of O_BENEATH & openat(2)
From: Kees Cook @ 2014-11-04 18:47 UTC (permalink / raw)
To: David Drysdale
Cc: LKML, Alexander Viro, Eric W. Biederman, Greg Kroah-Hartman,
Meredydd Luff, Will Drewry, Jorge Lucangeli Obes, Ricky Zhou,
Lee Campbell, Julien Tinnes, Mike Depinet, James Morris,
Andy Lutomirski, Paolo Bonzini, Paul Moore, Christoph Hellwig,
Linux API, linux-security-module
In-Reply-To: <1415094884-18349-3-git-send-email-drysdale@google.com>
On Tue, Nov 4, 2014 at 1:54 AM, David Drysdale <drysdale@google.com> wrote:
> Add simple tests of openat(2) variations, including examples that
> check the new O_BENEATH flag.
>
> Signed-off-by: David Drysdale <drysdale@google.com>
Excellent! Thank you for including self tests. :)
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> tools/testing/selftests/Makefile | 1 +
> tools/testing/selftests/openat/.gitignore | 4 +
> tools/testing/selftests/openat/Makefile | 28 +++++
> tools/testing/selftests/openat/openat.c | 180 ++++++++++++++++++++++++++++++
> 4 files changed, 213 insertions(+)
> create mode 100644 tools/testing/selftests/openat/.gitignore
> create mode 100644 tools/testing/selftests/openat/Makefile
> create mode 100644 tools/testing/selftests/openat/openat.c
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 36ff2e4c7b6f..812e973233d2 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -14,6 +14,7 @@ TARGETS += powerpc
> TARGETS += user
> TARGETS += sysctl
> TARGETS += firmware
> +TARGETS += openat
>
> TARGETS_HOTPLUG = cpu-hotplug
> TARGETS_HOTPLUG += memory-hotplug
> diff --git a/tools/testing/selftests/openat/.gitignore b/tools/testing/selftests/openat/.gitignore
> new file mode 100644
> index 000000000000..835b2dcd8678
> --- /dev/null
> +++ b/tools/testing/selftests/openat/.gitignore
> @@ -0,0 +1,4 @@
> +openat
> +subdir
> +topfile
> +symlinkdown
> \ No newline at end of file
> diff --git a/tools/testing/selftests/openat/Makefile b/tools/testing/selftests/openat/Makefile
> new file mode 100644
> index 000000000000..84cd06e7ee82
> --- /dev/null
> +++ b/tools/testing/selftests/openat/Makefile
> @@ -0,0 +1,28 @@
> +CC = $(CROSS_COMPILE)gcc
> +CFLAGS = -Wall
> +BINARIES = openat
> +DEPS = subdir topfile symlinkdown subdir/bottomfile subdir/symlinkup subdir/symlinkout subdir/symlinkin
> +all: $(BINARIES) $(DEPS)
> +
> +subdir:
> + mkdir -p subdir
> +topfile:
> + echo 0123456789 > $@
> +subdir/bottomfile: | subdir
> + echo 0123456789 > $@
> +subdir/symlinkup: | subdir
> + ln -s ../topfile $@
> +subdir/symlinkout: | subdir
> + ln -s /etc/passwd $@
> +subdir/symlinkin: | subdir
> + ln -s bottomfile $@
> +symlinkdown:
> + ln -s subdir/bottomfile $@
> +%: %.c
> + $(CC) $(CFLAGS) -o $@ $^
> +
> +run_tests: all
> + ./openat
> +
> +clean:
> + rm -rf $(BINARIES) $(DEPS)
> diff --git a/tools/testing/selftests/openat/openat.c b/tools/testing/selftests/openat/openat.c
> new file mode 100644
> index 000000000000..0c030cbd10dc
> --- /dev/null
> +++ b/tools/testing/selftests/openat/openat.c
> @@ -0,0 +1,180 @@
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <sys/syscall.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <string.h>
> +#include <errno.h>
> +
> +#include <linux/fcntl.h>
> +
> +/* Bypass glibc */
> +static int openat_(int dirfd, const char *pathname, int flags)
> +{
> + return syscall(__NR_openat, dirfd, pathname, flags);
> +}
> +
> +static int openat_or_die(int dfd, const char *path, int flags)
> +{
> + int fd = openat_(dfd, path, flags);
> +
> + if (fd < 0) {
> + printf("Failed to openat(%d, '%s'); "
> + "check prerequisites are available\n", dfd, path);
> + exit(1);
> + }
> + return fd;
> +}
> +
> +static int check_openat(int dfd, const char *path, int flags)
> +{
> + int rc;
> + int fd;
> + char buffer[4];
> +
> + errno = 0;
> + printf("Check success of openat(%d, '%s', %x)... ",
> + dfd, path?:"(null)", flags);
> + fd = openat_(dfd, path, flags);
> + if (fd < 0) {
> + printf("[FAIL]: openat() failed, rc=%d errno=%d (%s)\n",
> + fd, errno, strerror(errno));
> + return 1;
> + }
> + errno = 0;
> + rc = read(fd, buffer, sizeof(buffer));
> + if (rc < 0) {
> + printf("[FAIL]: read() failed, rc=%d errno=%d (%s)\n",
> + rc, errno, strerror(errno));
> + return 1;
> + }
> + close(fd);
> + printf("[OK]\n");
> + return 0;
> +}
> +
> +#define check_openat_fail(dfd, path, flags, errno) \
> + _check_openat_fail(dfd, path, flags, errno, #errno)
> +static int _check_openat_fail(int dfd, const char *path, int flags,
> + int expected_errno, const char *errno_str)
> +{
> + int rc;
> +
> + errno = 0;
> + printf("Check failure of openat(%d, '%s', %x) with %s... ",
> + dfd, path?:"(null)", flags, errno_str);
> + rc = openat_(dfd, path, flags);
> + if (rc > 0) {
> + printf("[FAIL] (unexpected success from openat(2))\n");
> + close(rc);
> + return 1;
> + }
> + if (errno != expected_errno) {
> + printf("[FAIL] (expected errno %d (%s) not %d (%s)\n",
> + expected_errno, strerror(expected_errno),
> + errno, strerror(errno));
> + return 1;
> + }
> + printf("[OK]\n");
> + return 0;
> +}
> +
> +int check_proc(void)
> +{
> + int proc_dfd = openat_(AT_FDCWD, "/proc/self", O_RDONLY);
> + int fail = 0;
> +
> + if (proc_dfd < 0) {
> + printf("'/proc/self' unavailable (errno=%d '%s'), skipping\n",
> + errno, strerror(errno));
> + return 1;
> + }
> + fail |= check_openat(proc_dfd, "root/etc/passwd", O_RDONLY);
> +#ifdef O_BENEATH
> + fail |= check_openat_fail(proc_dfd, "root/etc/passwd",
> + O_RDONLY|O_BENEATH, EPERM);
> +#endif
> + return fail;
> +}
> +
> +int main(int argc, char *argv[])
> +{
> + int fail = 0;
> + int dot_dfd = openat_or_die(AT_FDCWD, ".", O_RDONLY);
> + int subdir_dfd = openat_or_die(AT_FDCWD, "subdir", O_RDONLY);
> + int file_fd = openat_or_die(AT_FDCWD, "topfile", O_RDONLY);
> +
> + /* Sanity check normal behavior */
> + fail |= check_openat(AT_FDCWD, "topfile", O_RDONLY);
> + fail |= check_openat(AT_FDCWD, "subdir/bottomfile", O_RDONLY);
> +
> + fail |= check_openat(dot_dfd, "topfile", O_RDONLY);
> + fail |= check_openat(dot_dfd, "subdir/bottomfile", O_RDONLY);
> + fail |= check_openat(dot_dfd, "subdir/../topfile", O_RDONLY);
> +
> + fail |= check_openat(subdir_dfd, "../topfile", O_RDONLY);
> + fail |= check_openat(subdir_dfd, "bottomfile", O_RDONLY);
> + fail |= check_openat(subdir_dfd, "../subdir/bottomfile", O_RDONLY);
> + fail |= check_openat(subdir_dfd, "symlinkup", O_RDONLY);
> + fail |= check_openat(subdir_dfd, "symlinkout", O_RDONLY);
> +
> + fail |= check_openat(AT_FDCWD, "/etc/passwd", O_RDONLY);
> + fail |= check_openat(dot_dfd, "/etc/passwd", O_RDONLY);
> + fail |= check_openat(subdir_dfd, "/etc/passwd", O_RDONLY);
> +
> + fail |= check_openat_fail(AT_FDCWD, "bogus", O_RDONLY, ENOENT);
> + fail |= check_openat_fail(dot_dfd, "bogus", O_RDONLY, ENOENT);
> + fail |= check_openat_fail(999, "bogus", O_RDONLY, EBADF);
> + fail |= check_openat_fail(file_fd, "bogus", O_RDONLY, ENOTDIR);
> +
> +#ifdef O_BENEATH
> + /* Test out O_BENEATH */
> + fail |= check_openat(AT_FDCWD, "topfile", O_RDONLY|O_BENEATH);
> + fail |= check_openat(AT_FDCWD, "subdir/bottomfile",
> + O_RDONLY|O_BENEATH);
> +
> + fail |= check_openat(dot_dfd, "topfile", O_RDONLY|O_BENEATH);
> + fail |= check_openat(dot_dfd, "subdir/bottomfile",
> + O_RDONLY|O_BENEATH);
> + fail |= check_openat(subdir_dfd, "bottomfile", O_RDONLY|O_BENEATH);
> +
> + /* Symlinks without .. or leading / are OK */
> + fail |= check_openat(dot_dfd, "symlinkdown", O_RDONLY|O_BENEATH);
> + fail |= check_openat(dot_dfd, "subdir/symlinkin", O_RDONLY|O_BENEATH);
> + fail |= check_openat(subdir_dfd, "symlinkin", O_RDONLY|O_BENEATH);
> + /* ... unless of course we specify O_NOFOLLOW */
> + fail |= check_openat_fail(dot_dfd, "symlinkdown",
> + O_RDONLY|O_BENEATH|O_NOFOLLOW, ELOOP);
> + fail |= check_openat_fail(dot_dfd, "subdir/symlinkin",
> + O_RDONLY|O_BENEATH|O_NOFOLLOW, ELOOP);
> + fail |= check_openat_fail(subdir_dfd, "symlinkin",
> + O_RDONLY|O_BENEATH|O_NOFOLLOW, ELOOP);
> +
> + /* Can't open paths with ".." in them */
> + fail |= check_openat_fail(dot_dfd, "subdir/../topfile",
> + O_RDONLY|O_BENEATH, EPERM);
> + fail |= check_openat_fail(subdir_dfd, "../topfile",
> + O_RDONLY|O_BENEATH, EPERM);
> + fail |= check_openat_fail(subdir_dfd, "../subdir/bottomfile",
> + O_RDONLY|O_BENEATH, EPERM);
> +
> + /* Can't open paths starting with "/" */
> + fail |= check_openat_fail(AT_FDCWD, "/etc/passwd",
> + O_RDONLY|O_BENEATH, EPERM);
> + fail |= check_openat_fail(dot_dfd, "/etc/passwd",
> + O_RDONLY|O_BENEATH, EPERM);
> + fail |= check_openat_fail(subdir_dfd, "/etc/passwd",
> + O_RDONLY|O_BENEATH, EPERM);
> + /* Can't sneak around constraints with symlinks */
> + fail |= check_openat_fail(subdir_dfd, "symlinkup",
> + O_RDONLY|O_BENEATH, EPERM);
> + fail |= check_openat_fail(subdir_dfd, "symlinkout",
> + O_RDONLY|O_BENEATH, EPERM);
> +#else
> + printf("Skipping O_BENEATH tests due to missing #define\n");
> +#endif
> + fail |= check_proc();
> +
> + return fail ? -1 : 0;
> +}
> --
> 2.1.0.rc2.206.gedb03e5
>
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* Re: [PATCH v3 2/3] perf: Userspace event
From: Peter Zijlstra @ 2014-11-04 18:40 UTC (permalink / raw)
To: Pawel Moll
Cc: Namhyung Kim, Richard Cochran, Steven Rostedt, Ingo Molnar,
Paul Mackerras, Arnaldo Carvalho de Melo, John Stultz,
Masami Hiramatsu, Christopher Covington, David Ahern,
Thomas Gleixner, Tomeu Vizoso,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <1415119331.24819.19.camel-5wv7dgnIgG8@public.gmane.org>
On Tue, Nov 04, 2014 at 04:42:11PM +0000, Pawel Moll wrote:
>
> 1. I'm wrong and the record doesn't have to be padded to make it 8 bytes
> aligned. Then I can drop the additional size field.
No, you're right, we're supposed to stay 8 byte aligned.
> 2. I could impose a limitation on the prctl API that the data size must
> be 8 bytes aligned. Bad idea in my opinion, I'd rather not.
Agreed.
> 3. The additional size (for the data part) field stays. Notice that
> PERF_SAMPLE_RAW has it as well :-)
Right, with binary data there is no other day. With \0 terminated
strings there won't be a problem, but I think we decided we wanted to
allow any binary blow.
^ permalink raw reply
* [PATCH 20/20] selftests/user: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/user/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/user/Makefile b/tools/testing/selftests/user/Makefile
index 12c9d15..c8e3863 100644
--- a/tools/testing/selftests/user/Makefile
+++ b/tools/testing/selftests/user/Makefile
@@ -3,5 +3,12 @@
# No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
all:
+install: all
+ install ./test_user_copy.sh $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start user copy test ....\"" >> $(KSELFTEST)
+ echo "./test_user_copy.sh" >> $(KSELFTEST)
+ echo "echo \"End user copy test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all
./test_user_copy.sh
--
1.9.1
^ permalink raw reply related
* [PATCH 19/20] selftests/vm: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/vm/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 4c4b1f6..254ce92 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -9,6 +9,13 @@ all: $(BINARIES)
%: %.c
$(CC) $(CFLAGS) -o $@ $^
+install: all
+ install run_vmtests $(BINARIES) $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start vm test ....\"" >> $(KSELFTEST)
+ echo "/bin/sh ./run_vmtests || echo \"vmtests: [FAIL]\"" >> $(KSELFTEST)
+ echo "echo \"End vm test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all
@/bin/sh ./run_vmtests || (echo "vmtests: [FAIL]"; exit 1)
--
1.9.1
^ permalink raw reply related
* [PATCH 18/20] selftests/timers: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/timers/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
index eb2859f..5fce7ae 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,13 @@
all:
gcc posix_timers.c -o posix_timers -lrt
+install: all
+ install ./posix_timers $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start timers test ....\"" >> $(KSELFTEST)
+ echo "./posix_timers" >> $(KSELFTEST)
+ echo "echo \"End timers test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all
./posix_timers
--
1.9.1
^ permalink raw reply related
* [PATCH 17/20] selftests/sysctl: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/sysctl/Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/sysctl/Makefile b/tools/testing/selftests/sysctl/Makefile
index 0a92ada..c8d9b2b 100644
--- a/tools/testing/selftests/sysctl/Makefile
+++ b/tools/testing/selftests/sysctl/Makefile
@@ -4,6 +4,8 @@
# No binaries, but make sure arg-less "make" doesn't trigger "run_tests".
all:
+INSTALL_PROGS = common_tests run_numerictests run_stringtests
+
# Allow specific tests to be selected.
test_num:
@/bin/sh ./run_numerictests
@@ -11,6 +13,14 @@ test_num:
test_string:
@/bin/sh ./run_stringtests
+install: all
+ install $(INSTALL_PROGS) $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start sysctl test ....\"" >> $(KSELFTEST)
+ echo "/bin/sh ./run_numerictests" >> $(KSELFTEST)
+ echo "/bin/sh ./run_stringtests" >> $(KSELFTEST)
+ echo "echo \"End sysctl test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all test_num test_string
# Nothing to clean up.
--
1.9.1
^ permalink raw reply related
* [PATCH 16/20] selftests/ptrace: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/ptrace/Makefile | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ptrace/Makefile b/tools/testing/selftests/ptrace/Makefile
index 47ae2d3..7826045 100644
--- a/tools/testing/selftests/ptrace/Makefile
+++ b/tools/testing/selftests/ptrace/Makefile
@@ -1,7 +1,14 @@
CFLAGS += -iquote../../../../include/uapi -Wall
-peeksiginfo: peeksiginfo.c
-all: peeksiginfo
+all:
+ gcc peeksiginfo.c -o peeksiginfo
+
+install: all
+ install ./peeksiginfo $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start ptrace test ....\"" >> $(KSELFTEST)
+ echo "./peeksiginfo || echo \"peeksiginfo selftests: [FAIL]\"" >> $(KSELFTEST)
+ echo "echo \"End ptrace test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
clean:
rm -f peeksiginfo
--
1.9.1
^ permalink raw reply related
* [PATCH 15/20] selftests/net: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/net/Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 62f22cc..988e722 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -6,11 +6,21 @@ CFLAGS = -Wall -O2 -g
CFLAGS += -I../../../../usr/include/
NET_PROGS = socket psock_fanout psock_tpacket
+INSTALL_PROGS = run_netsocktests run_afpackettests test_bpf.sh $(NET_PROGS)
all: $(NET_PROGS)
%: %.c
$(CC) $(CFLAGS) -o $@ $^
+install: all
+ install $(INSTALL_PROGS) $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start net test ....\"" >> $(KSELFTEST)
+ echo "/bin/sh ./run_netsocktests || echo \"sockettests: [FAIL]\"" >> $(KSELFTEST)
+ echo "/bin/sh ./run_afpackettests || echo \"afpackettests: [FAIL]\"" >> $(KSELFTEST)
+ echo "./test_bpf.sh" >> $(KSELFTEST)
+ echo "echo \"End net test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all
@/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
@/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 14/20] selftests/mqueue: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, mmarek-AlSwsSmVLrQ,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, keescook-F7+t8E8rja9g9hUCZPvPmw,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
dh.herrmann-Re5JQEeQqe8AvxtiuMwx3w, hughd-hpIqsD4AKlfQT0dZR+AlfA,
bobby.prani-Re5JQEeQqe8AvxtiuMwx3w,
ebiederm-aS9lmoZGLiVWk0Htik3J/w,
serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
Cc: Shuah Khan, linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1415117102.git.shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
---
tools/testing/selftests/mqueue/Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile
index 8056e2e..b0b5ef7 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -2,6 +2,14 @@ all:
gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
+install: all
+ install ./mq_open_tests $(INSTALL_KSFT_PATH)
+ install ./mq_perf_tests $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start mqueue test ....\"" >> $(KSELFTEST)
+ echo "./mq_open_tests /test1 || echo \"mq_open_tests: [FAIL]\"" >> $(KSELFTEST)
+ echo "./mq_perf_tests || echo \"mq_perf_tests: [FAIL]\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests:
@./mq_open_tests /test1 || echo "mq_open_tests: [FAIL]"
@./mq_perf_tests || echo "mq_perf_tests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 13/20] selftests/mount: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/mount/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
index 337d853..3bcb112 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -9,6 +9,13 @@ unprivileged-remount-test: unprivileged-remount-test.c
test_unprivileged_remount: unprivileged-remount-test
@if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi
+install: all
+ install ./unprivileged-remount-test $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start mount test ....\"" >> $(KSELFTEST)
+ echo "if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi" >> $(KSELFTEST)
+ echo "echo \"End mount test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all test_unprivileged_remount
clean:
--
1.9.1
^ permalink raw reply related
* [PATCH 12/20] selftests/memory-hotplug: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/memory-hotplug/Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile
index d46b8d4..3c32820 100644
--- a/tools/testing/selftests/memory-hotplug/Makefile
+++ b/tools/testing/selftests/memory-hotplug/Makefile
@@ -1,5 +1,14 @@
+TEST_STR="/bin/bash ./mem-on-off-test.sh -r 2 || echo \"memory-hotplug selftests: [FAIL]\""
+
all:
+install:
+ install ./on-off-test.sh $(INSTALL_KSFT_PATH)/mem-on-off-test.sh
+ echo "\necho \"Start memory hotplug test ....\"" >> $(KSELFTEST)
+ echo $(TEST_STR) >> $(KSELFTEST)
+ echo "echo \"End memory hotplug test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests:
@/bin/bash ./on-off-test.sh -r 2 || echo "memory-hotplug selftests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 11/20] selftests/memfd: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, mmarek-AlSwsSmVLrQ,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, keescook-F7+t8E8rja9g9hUCZPvPmw,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
dh.herrmann-Re5JQEeQqe8AvxtiuMwx3w, hughd-hpIqsD4AKlfQT0dZR+AlfA,
bobby.prani-Re5JQEeQqe8AvxtiuMwx3w,
ebiederm-aS9lmoZGLiVWk0Htik3J/w,
serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
Cc: Shuah Khan, linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1415117102.git.shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
---
tools/testing/selftests/memfd/Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index b80cd10..bf03ec03 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -2,9 +2,19 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I../../../../include/uapi/
CFLAGS += -I../../../../include/
+INSTALL_PROGS = memfd_test fuse_test run_fuse_test.sh
+
all:
gcc $(CFLAGS) memfd_test.c -o memfd_test
+install: all build_fuse
+ install $(INSTALL_PROGS) $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start memfd test ....\"" >> $(KSELFTEST)
+ echo "./memfd_test || echo \"memfd_test: [FAIL]\"" >> $(KSELFTEST)
+ echo "./run_fuse_test.sh || echo \"fuse_test: [FAIL]\"" >> $(KSELFTEST)
+ echo "echo \"End memfd test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all
gcc $(CFLAGS) memfd_test.c -o memfd_test
@./memfd_test || echo "memfd_test: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 10/20] selftests/kcmp: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/kcmp/Makefile | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 8aabd82..e105619 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -21,6 +21,18 @@ else
echo "Not an x86 target, can't build kcmp selftest"
endif
+install: all
+ifeq ($(ARCH),x86)
+ install ./kcmp_test $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start kcmp test ....\"" >> $(KSELFTEST)
+ echo "./kcmp_test || echo \"kcmp_test: [FAIL]\"" >> $(KSELFTEST)
+ echo "rm -f kcmp-test-file" >> $(KSELFTEST)
+ echo "echo \"End kcmp test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+else
+ echo "Not an x86 target, can't install kcmp selftests"
+endif
+
run_tests: all
@./kcmp_test || echo "kcmp_test: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 09/20] selftests/ipc: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/ipc/Makefile | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile
index 74bbefd..cd1c5af 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -18,6 +18,17 @@ else
echo "Not an x86 target, can't build msgque selftest"
endif
+install: all
+ifeq ($(ARCH),x86)
+ install ./msgque_test $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start ipc msgque test ....\"" >> $(KSELFTEST)
+ echo "./msgque_test || echo \"ipc msgque test: [FAIL]\"" >> $(KSELFTEST)
+ echo "echo \"End msgque test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+else
+ echo "Not an x86 target, can't install ipc msgque selftests"
+endif
+
run_tests: all
./msgque_test
--
1.9.1
^ permalink raw reply related
* [PATCH 08/20] selftests/firmware: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, mmarek-AlSwsSmVLrQ,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, keescook-F7+t8E8rja9g9hUCZPvPmw,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
dh.herrmann-Re5JQEeQqe8AvxtiuMwx3w, hughd-hpIqsD4AKlfQT0dZR+AlfA,
bobby.prani-Re5JQEeQqe8AvxtiuMwx3w,
ebiederm-aS9lmoZGLiVWk0Htik3J/w,
serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
Cc: Shuah Khan, linux-kbuild-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1415117102.git.shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
---
tools/testing/selftests/firmware/Makefile | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/testing/selftests/firmware/Makefile b/tools/testing/selftests/firmware/Makefile
index e23cce0..d5008ec 100644
--- a/tools/testing/selftests/firmware/Makefile
+++ b/tools/testing/selftests/firmware/Makefile
@@ -19,6 +19,26 @@ fw_userhelper:
exit 1; \
fi
+install: all
+ install ./fw_filesystem.sh ./fw_userhelper.sh $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start firmware filesystem test ....\"" >> $(KSELFTEST)
+ echo "if /bin/sh ./fw_filesystem.sh ; then \\" >> $(KSELFTEST)
+ echo "\techo \"fw_filesystem: ok \"; \\" >> $(KSELFTEST)
+ echo "else \\" >> $(KSELFTEST)
+ echo "\techo \"fw_filesystem: [FAIL] \"; \\" >> $(KSELFTEST)
+ echo "fi" >> $(KSELFTEST)
+ echo "echo \"End firmware filesystem test ....\"" >> $(KSELFTEST)
+ echo "echo \"--------------------\"" >> $(KSELFTEST)
+
+ echo "echo \"Start firmware userhelper test ....\"" >> $(KSELFTEST)
+ echo "if /bin/sh ./fw_userhelper.sh ; then \\" >> $(KSELFTEST)
+ echo "\techo \"fw_userhelper: ok\"; \\" >> $(KSELFTEST)
+ echo "else \\" >> $(KSELFTEST)
+ echo "\techo \"fw_userhelper: [FAIL] \"; \\" >> $(KSELFTEST)
+ echo "fi" >> $(KSELFTEST)
+ echo "echo \"End firmware userhelper test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests: all fw_filesystem fw_userhelper
# Nothing to clean up.
--
1.9.1
^ permalink raw reply related
* [PATCH 07/20] selftests/efivarfs: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/efivarfs/Makefile | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/efivarfs/Makefile b/tools/testing/selftests/efivarfs/Makefile
index 29e8c6b..a668728 100644
--- a/tools/testing/selftests/efivarfs/Makefile
+++ b/tools/testing/selftests/efivarfs/Makefile
@@ -3,7 +3,18 @@ CFLAGS = -Wall
test_objs = open-unlink create-read
-all: $(test_objs)
+TEST_STR = "/bin/bash ./efivarfs.sh || echo \"efivarfs selftests: [FAIL]\""
+
+all:
+ gcc open-unlink.c -o open-unlink
+ gcc create-read.c -o create-read
+
+install: all
+ install ./efivarfs.sh $(test_objs) $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start efivarfs test ....\"" >> $(KSELFTEST)
+ echo $(TEST_STR) >> $(KSELFTEST)
+ echo "echo \"End efivarfs test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
run_tests: all
@/bin/bash ./efivarfs.sh || echo "efivarfs selftests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 06/20] selftests/cpu-hotplug: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/cpu-hotplug/Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile
index e9c28d8..3075d3a 100644
--- a/tools/testing/selftests/cpu-hotplug/Makefile
+++ b/tools/testing/selftests/cpu-hotplug/Makefile
@@ -1,5 +1,14 @@
+TEST_STR="/bin/bash ./cpu-on-off-test.sh || echo \"cpu-hotplug selftests: [FAIL]\""
+
all:
+install:
+ install ./on-off-test.sh $(INSTALL_KSFT_PATH)/cpu-on-off-test.sh
+ echo "\necho \"Start cpu hotplug test ....\"" >> $(KSELFTEST)
+ echo $(TEST_STR) >> $(KSELFTEST)
+ echo "echo \"End cpu hotplug test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+
run_tests:
@/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 05/20] selftests/breakpoints: add install target to enable installing test
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/breakpoints/Makefile | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/testing/selftests/breakpoints/Makefile b/tools/testing/selftests/breakpoints/Makefile
index e18b42b..4b4e385 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -8,6 +8,7 @@ ifeq ($(ARCH),x86_64)
ARCH := x86
endif
+TEST_STR = "./breakpoint_test || echo \"breakpoints selftests: [FAIL]\""
all:
ifeq ($(ARCH),x86)
@@ -16,6 +17,17 @@ else
echo "Not an x86 target, can't build breakpoints selftests"
endif
+install: all
+ifeq ($(ARCH),x86)
+ install ./breakpoint_test $(INSTALL_KSFT_PATH)
+ echo "\necho \"Start breakpoints test ....\"" >> $(KSELFTEST)
+ echo $(TEST_STR) >> $(KSELFTEST)
+ echo "echo \"End breakpoints test ....\"" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+else
+ echo "Not an x86 target, can't install breakpoints selftests"
+endif
+
run_tests:
@./breakpoint_test || echo "breakpoints selftests: [FAIL]"
--
1.9.1
^ permalink raw reply related
* [PATCH 04/20] selftests: add install target to enable installing selftests
From: Shuah Khan @ 2014-11-04 17:11 UTC (permalink / raw)
To: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
hughd, bobby.prani, ebiederm, serge.hallyn
Cc: Shuah Khan, linux-kbuild, linux-kernel, linux-api, netdev
In-Reply-To: <cover.1415117102.git.shuahkh@osg.samsung.com>
Add a new make target to enable installing selftests. This
new target will call install targets for the tests that are
specified in INSTALL_TARGETS. During install, a script is
generated to run tests that are installed. This script will
be installed in the selftest install directory. Individual
test Makefiles are changed to add to the script. This will
allow new tests to add install and run test commands to the
generated kselftest script.
Approach:
make kselftest_target:
-- exports kselftest INSTALL_KSFT_PATH
default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
-- exports path for ksefltest.sh
-- runs selftests make install target:
selftests make install target
-- creates kselftest.sh script in install install dir
-- runs install targets for all INSTALL_TARGETS
Individual test make install targets:
-- install test programs and/or scripts in install dir
-- append to the ksefltest.sh file to add commands to run test
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/Makefile | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 45f145c..07b0244 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -16,6 +16,10 @@ TARGETS += sysctl
TARGETS += firmware
TARGETS += ftrace
+INSTALL_TARGETS = breakpoints cpu-hotplug efivarfs firmware ipc
+INSTALL_TARGETS += kcmp memfd memory-hotplug mqueue mount net
+INSTALL_TARGETS += ptrace sysctl timers user vm
+
TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug
@@ -24,6 +28,16 @@ all:
make -C $$TARGET; \
done;
+install: all
+ echo "#!/bin/sh\n# Kselftest Run Tests ...." > $(KSELFTEST)
+ echo "# This file is generated during kselftest_install" >> $(KSELFTEST)
+ echo "# Please don't change it !!\n" >> $(KSELFTEST)
+ echo "echo \"==============================\"" >> $(KSELFTEST)
+ for TARGET in $(INSTALL_TARGETS); do \
+ echo "\nInstalling $$TARGET"; \
+ make -C $$TARGET install; \
+ done;
+
run_tests: all
for TARGET in $(TARGETS); do \
make -C $$TARGET run_tests; \
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox