Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4218085pxb; Tue, 10 Nov 2020 10:39:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpXbkzGAFnVaJR+/tRzQdQ+id2FyhRodfyDi0alziejgY7U6zwlDkIVz1ql+rqQPyaP477 X-Received: by 2002:a50:cfcd:: with SMTP id i13mr21686366edk.275.1605033555501; Tue, 10 Nov 2020 10:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605033555; cv=none; d=google.com; s=arc-20160816; b=GuAHpHiT5/Os5dYYCFUvzfHK6L/SZ6aKxQoaeiOycFXwhi3lfhUYpynTQcs6plcG8j MdwFJF8imxsExWkNm/d1WRvl12320g9n5L/cl0OI+5mDztydzVGOSpsTkZmtANlx8Jjs 42tZ5l1WGUXwfnmG1qecmTgyjwoSIV6GYvoFPC4a5Dn/guzOXoE+Bkn0UC3H0pIxyG8G MFgctRrYRj2TKuWqzDtMomZRMKY2+WmS/hXN0A8MFxG5Q9MN6ZzYsBnK/nGgqYtUNwtw 9LbHQGrgbpKtQcpChQNXBrpMvs9nK407Cgkv0JX+joe++f7rOg1fzRxBV5lYWNvWU9AW /c0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EcW7DGdRYPQre9d0rCuZTVN2xdKVZeP/11KAhpcdeGQ=; b=e2ruKUSWZCZ3Hl2nt8H91hx/3o+MQw5m5hWOLaRypUcZVe8/5/bjPXja8OqCl9jRQW RSHrGdCLb5LkuRyNiKQCzJ/ldq4i8wlcUA/+9yIk+ueVpu1uj85ieSfHGo5F4ecD/MYV c2jDfiKjDxQ9X1XmcscrLt2UGAfaNogN39XqaMXdBfku5nROXeWi6HurHdtd1yQNTgVJ ObwCesU16Xi9ZuLCsGnkPAjRCBhjXuLrKxbmwmjoZoJTiG40ve5MIq+UB27xiZWUflGY mMoywV+mpavR6J5NOPrA4YY3JouogO52hBEHBLQwAArzGbRoesC6Zn+Fk89PlbirGb9O Z/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Bb7eV6Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si11508563ejj.33.2020.11.10.10.38.50; Tue, 10 Nov 2020 10:39:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Bb7eV6Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbgKJSfO (ORCPT + 99 others); Tue, 10 Nov 2020 13:35:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbgKJSfO (ORCPT ); Tue, 10 Nov 2020 13:35:14 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59953C0613D3 for ; Tue, 10 Nov 2020 10:35:14 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id k1so13126055ilc.10 for ; Tue, 10 Nov 2020 10:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EcW7DGdRYPQre9d0rCuZTVN2xdKVZeP/11KAhpcdeGQ=; b=Bb7eV6Ffk30/lADN/CtBQNkUYKmIlGDuP5HgNdb7lko796qK+rPQAotrkNWYHqh5li 76lujpo108QS9f8ZA53B/idZGNhYqH00HMORfhYexedWrdx5jeraYbXN85UdToL1n61m IXglx2VBB8XZji5DYomCSjDtBhqN1MWHhxeV45Vcu9otTPkCVMr1FltZPW9xNky0VTxe eidiazNZla3CPfk22mus83C/TSQMvzGRSvriokLQ2ZvS7v32J3z3Ya8r+ie53hSa28FI 8fZZe6y7gGahOslzrH1tnScTCa70j4VkRQXPfrdq0iSAJpfxAKuXo/t9AkMgD2bWLkOH 15Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EcW7DGdRYPQre9d0rCuZTVN2xdKVZeP/11KAhpcdeGQ=; b=Umm0dGOQbq87mzL+Df/P4jV/IJHS+PfpOI62ABpEz73d2WqSPV3we1dolEm0Gt97ed xxnlkY8gPURqaR2FWPDCMBtiDigLwA1s1rRD3FMMi6ckfEdYsrclI8QxL+GYtP+T4zld cbrYoBeZ3tS7S/OnmF+N+fxZaalOGrkiIRxN2Ne89ZhWim5q9Tt8nr0WLTRhGvCdItUD 9Ry/rNuCiKnpeLhq0GEJK7d1tbevaLkjVUBgfHPXXs13N64EBvNxSi38MsvOOJOsxJv0 bTeon8QuCPfgmLeaXt6O5iIi2mzMENW+x1Cq1in8yXIlQrxmBDjrHw0bKqbTyfyP+3+y BNcA== X-Gm-Message-State: AOAM533R3cdZTf+BB337P1LgZSfVgvRulHSHsZt/cUCQtMuL3QWbjqFo Lv5JH6/duMyPkCK1D9LpmSLMpAB74NFEVu0KRG+9/Q== X-Received: by 2002:a92:6504:: with SMTP id z4mr14758818ilb.282.1605033313560; Tue, 10 Nov 2020 10:35:13 -0800 (PST) MIME-Version: 1.0 References: <20201029183526.2131776-1-aleksandrnogikh@gmail.com> <20201029183526.2131776-2-aleksandrnogikh@gmail.com> <04d8c32a-06cd-d71a-43d9-47b1de6c7684@i-love.sakura.ne.jp> In-Reply-To: <04d8c32a-06cd-d71a-43d9-47b1de6c7684@i-love.sakura.ne.jp> From: Aleksandr Nogikh Date: Tue, 10 Nov 2020 21:35:02 +0300 Message-ID: Subject: Re: [PATCH v3 1/2] security: add fault injection capability To: Tetsuo Handa Cc: Aleksandr Nogikh , jmorris@namei.org, serge@hallyn.com, Akinobu Mita , Andrey Konovalov , Dmitry Vyukov , Marco Elver , Alexander Potapenko , Kees Cook , Casey Schaufler , LKML , linux-security-module@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 7:43 AM Tetsuo Handa wrote: > [...] > > By the way, fail_lsm_hooks.retval is "signed int" but debugfs_create_u32() handles "unsigned int". > Do we want to allow lsm_hooks_inject_fail() to inject arbitrary !IS_ERR_VALUE() values? Thanks for pointing it out. Technically, now it's possible to set a negative value - internally, the kernel will process negative integers anyway, and after casting the unsigned value to a signed one, retval will contain exactly what the user provided. However, if the user retrieves the attribute value, they won't get the exact value that was set (if it was negative). I'll change debugfs_create_u32 to something else in v4, so that it'll be more explicit and so that it'll be possible to read negative values normally.