Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp584897lqj; Sun, 2 Jun 2024 12:12:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXd+iJZuAHm1xnv0CvQbx0kmnbwpk/tPxr5HBSr1cuNx04BMsOhGtYCzpn58IXeXWnQ5YqH4a6yaCszv2yxZLfc5WBMMnkIvCvweZsfvg== X-Google-Smtp-Source: AGHT+IG8UGol9ZA+d15H0exfuL87vrm20BYot5Bop3yRSN8ScG/kITRipgtT6ftHI6XGyQ72cBwv X-Received: by 2002:a17:902:e84e:b0:1f6:6ad1:fdf9 with SMTP id d9443c01a7336-1f66ad21fb6mr24844205ad.57.1717355576124; Sun, 02 Jun 2024 12:12:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717355576; cv=pass; d=google.com; s=arc-20160816; b=cBEXd6+TF3krDGQElSqn+E+fqCCbRzbECdbax0Ae7GDNq4NzaT3K/2TPhBDsLxxIaj wwgtTaf8EHQGG2sUn+FsqsZnfqx/Ubs6rhl0HMLprHuem592OjkInL77NVROa5g7SDbi xBU4s55M3urU/64j49sarS9MMCuIImboU8seozc0RXI1rBv2s8qeyhV647yYyQSpF7Hs 1V4J8OLSEd9jEArwEINvSjYHYKvOJ7Y36YrRTSrIJunxPo9yicAQobb5e9UASQhhxijI I+DhQhAj76DiAMPoku7h2KsIse9vwMtaW+p1SwLlQVnLnqv/jJ1Gsi9KO2vLTYFIYLv1 d4KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=PuI3t+WrtTWNm+6l5EAvTGHIgvRSvsmXgaFgYPKJXa0=; fh=9759770ktUtTM0uNlvx2RTh6Qa2u9hRtqB173PYeUeQ=; b=xS6rjjY3WZXpY6MhXQn8Voe/tbr6nYBci242Q6ZwqqjX1YQ9iZvQQXUqH3ZbFu66AA SPb0A9RHlk5DcY7mBdUBzgHsfZogSHrqXvA4osq8U0yT1qtvTYj1UZAREytWb5cYLlT8 ZnY/OMYK/wx7/Zv/RuZ9ocCZEBRcn88wiIqaDgbexqH4AGTE40pXptWr1nJpjzeuYsnz 0YkNlmp62m/58lSYPPOXHLl/F6WomT60ASG4FRXnlVvxDv6Y4H4+GVzodr4UNUTfOvDv UCkbrMl63Jb1GqN4dUt/iqeIkEGG0FTI6eSX1ZfQ69K9oblSVIcRkPQzQ15kbg2obM2F 8iDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jAHNBO8I; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6679226aasi16718545ad.235.2024.06.02.12.12.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 12:12:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jAHNBO8I; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2C219B2104D for ; Sun, 2 Jun 2024 19:12:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EB136F076; Sun, 2 Jun 2024 19:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jAHNBO8I" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F1B26EB4C; Sun, 2 Jun 2024 19:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717355564; cv=none; b=VCoXZdy/r16m8RZRntPyfPwPme5axBKMokC3ixlCdgZh+E0tL8QSwG6SaNfr8/D4IaAVR+8e8ez5OyHBOvkZF3/75rYmoTL+EudAKXkommL6tFsHT7Cn7i3YbOUWbc25mAb4VhAab7zb/2CldxdvsYR9xubgBkriRi5zWi+Y7xc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717355564; c=relaxed/simple; bh=qHG8QH+/mqunfB8u59RD3z93f1SMBtf8VW7kHlq4QEY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OtwGw9JaDf6yqq29dq4E1PpcrMpV1+n+c/2YdlwekwfT3xmBzhmxiaBZ0is9qqDYkaXhMLl4alLKxsf0Lfc2cr/1hJUhuOgeic8hYhoy/hV1rmHcH6wWki1XQJqfVi8gQvwxQp/OKLHe9fsq02EmDcM3tG9fRGY2VWUkqQAoUSw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jAHNBO8I; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-35dce6102f4so2394540f8f.3; Sun, 02 Jun 2024 12:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717355561; x=1717960361; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PuI3t+WrtTWNm+6l5EAvTGHIgvRSvsmXgaFgYPKJXa0=; b=jAHNBO8IIrqXefUcl+YtE+l9Pc7UURhNR20P7bY/vv3MLi7KcdzkkRvPtrMAzlKZnu nG9wIHayeysYnwMTg/9thinZD49r5Du8dreOBtongIoLUY8qQuxNXUrMhdS4Ff7kqqsX BjGaGovIyXfuQm+QLXWSUy/vVaiRrA8WYPOPDXK+fbf9bgq17CnrIEkGKiv8GTxozGmk W065xurskAnhle+imEAnQhlIFA05PIzkaDS/JotIdDfYz7+kvPjXIV50Vs1/45FRNS2q 70xpaT6Ft43CLm6RjCuV9Bw1QraotOUvwKivtGBS6H2k36oTpu55U0lT3DQchCkq2fOB FTZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717355561; x=1717960361; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PuI3t+WrtTWNm+6l5EAvTGHIgvRSvsmXgaFgYPKJXa0=; b=AVeDxSbrW2gcsjwXhOVuAMEy4JTwTsPrvKHlO4F7cMuzfz0WLVV04MhE55MeHSqMPz S9JcEz6D4UP+/GBbZUjHWnfOFrYoEqgifPZNYh0SDaoJG7ydvSIXtYzTnHl3L+EcWqKc 7u4UPMg/IBM8lQCiY1hxwE6w1pi13A2a2/4ufwYDI9hyrF4fK61HOZpzTCsl33aRHAy8 WkHW/dqVbxVTCSj+F0bX6hMwqdgFOpp7bjUi+soV13hEaWKzdy0kSTjTWTWWp1qnRSsP vOCusZw0OAczz/RJpjbyfn6qcb303TGJ0iEPFJ0fzMYEwaNU3mBu330L/p49zyaPSm/C EnpQ== X-Forwarded-Encrypted: i=1; AJvYcCXIFBg8mKLNv58p3QNRT+ttIc1R/eivjbTGL01lwQx2THQ54Cs/8XBBp/6C87MAxfCxYJdz8CxFBEvizMWp/pwueMcn5QvD9DWN/lfxSYQwf8FjJOmBVLlUpWA8f1+XNA2Zr04W2h4WeWrar18wYmM+T+Q2MukdPfZz5F916z5pCamkUr/F X-Gm-Message-State: AOJu0Ywuvqn8kxfXwSfj5Z5kXtACuydI+Evwvidvr67+llHAPFCSyek+ 1HeCM/NqK/C6I50gWtq9/MIkox2/+ELlaYy3shEaIcAgmGNjuoSKfXyNJxY67P/fosnQU2awwec jEu1cZ0pTkbCqfHRNvWMNfgdqvbm6KA== X-Received: by 2002:adf:f7cd:0:b0:355:2ae:d88d with SMTP id ffacd0b85a97d-35e0f285b12mr5495442f8f.34.1717355561135; Sun, 02 Jun 2024 12:12:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240531-fault-injection-statickeys-v1-0-a513fd0a9614@suse.cz> <20240531-fault-injection-statickeys-v1-3-a513fd0a9614@suse.cz> In-Reply-To: From: Alexei Starovoitov Date: Sun, 2 Jun 2024 12:12:29 -0700 Message-ID: Subject: Re: [PATCH RFC 3/4] mm, slab: add static key for should_failslab() To: Vlastimil Babka Cc: Akinobu Mita , Christoph Lameter , David Rientjes , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Masami Hiramatsu , Steven Rostedt , Mark Rutland , Jiri Olsa , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, LKML , linux-mm , bpf , linux-trace-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jun 1, 2024 at 1:57=E2=80=AFPM Vlastimil Babka wro= te: > > On 5/31/24 6:43 PM, Alexei Starovoitov wrote: > > On Fri, May 31, 2024 at 2:33=E2=80=AFAM Vlastimil Babka wrote: > >> might_alloc(flags); > >> > >> - if (unlikely(should_failslab(s, flags))) > >> - return NULL; > >> + if (static_branch_unlikely(&should_failslab_active)) { > >> + if (should_failslab(s, flags)) > >> + return NULL; > >> + } > > > > makes sense. > > Acked-by: Alexei Starovoitov > > Thanks :) but please note the cover letter where I explain how I need hel= p > with the bpftrace side (and ftrace, but that seems sorted). Without that > part, bpftrace will silently stop doing the injection as the static key w= ill > remain disabled. Right. That part was clear. Once this set lands we can add static key on/off logic either in the kernel directly, or in libbpf. In the kernel is certainly cleaner. How will ftrace handle it? I couldn't figure it out from this set. Ideally key toggle should be a part of generic kprobe attach logic and not bpf specific, then both bpf and kprobe will work.