From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH bpf] bpf: disable and restore preemption in __BPF_PROG_RUN_ARRAY Date: Mon, 23 Apr 2018 14:05:21 -0600 Message-ID: <20180423200519.nncc52lfi2xq44ni@ast-mbp> References: <20180423170921.16162-1-guro@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, kernel-team@fb.com, Alexei Starovoitov , Daniel Borkmann To: Roman Gushchin Return-path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:41626 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932306AbeDWUFY (ORCPT ); Mon, 23 Apr 2018 16:05:24 -0400 Received: by mail-pg0-f68.google.com with SMTP id m21so6114339pgv.8 for ; Mon, 23 Apr 2018 13:05:24 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180423170921.16162-1-guro@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Apr 23, 2018 at 06:09:21PM +0100, Roman Gushchin wrote: > Running bpf programs requires disabled preemption, > however at least some* of the BPF_PROG_RUN_ARRAY users > do not follow this rule. > > To fix this bug, and also to make it not happen in the future, > let's add explicit preemption disabling/re-enabling > to the __BPF_PROG_RUN_ARRAY code. > > * for example: > [ 17.624472] RIP: 0010:__cgroup_bpf_run_filter_sk+0x1c4/0x1d0 > ... > [ 17.640890] inet6_create+0x3eb/0x520 > [ 17.641405] __sock_create+0x242/0x340 > [ 17.641939] __sys_socket+0x57/0xe0 > [ 17.642370] ? trace_hardirqs_off_thunk+0x1a/0x1c > [ 17.642944] SyS_socket+0xa/0x10 > [ 17.643357] do_syscall_64+0x79/0x220 > [ 17.643879] entry_SYSCALL_64_after_hwframe+0x42/0xb7 > > Signed-off-by: Roman Gushchin > Cc: Alexei Starovoitov > Cc: Daniel Borkmann Acked-by: Alexei Starovoitov