Received: by 2002:ab2:5182:0:b0:1f4:61d5:3ad4 with SMTP id x2csp40829lqi; Fri, 5 Apr 2024 09:12:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdJIDh7u2V1rexdn5Iwg6yFnGsJTvLUoO/+81gJ8sopbTjexnthQHBNnvRpobLDwr5dI5waG6seZrMaiG7j8JCluh2i+eWupKWaLrnzg== X-Google-Smtp-Source: AGHT+IHW5GdGoYQBXoYLhYRrIYh3Icnf9Cdjd5TRUYBl8lahR9RnHO46M3NxzVyu1Ut9LJhvf0Pj X-Received: by 2002:a50:d7c7:0:b0:56e:2a7a:27e4 with SMTP id m7-20020a50d7c7000000b0056e2a7a27e4mr1458600edj.39.1712333575743; Fri, 05 Apr 2024 09:12:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712333575; cv=pass; d=google.com; s=arc-20160816; b=yVD0sR00On6tqfelo6TFlgcA6ao8YSxdmMjv7WMwag8reE3t21HCn37bBv/PAea6Kj HBrDlpM9HEatugM7oM112JmMMlRJCztDXmJwGVf3ND9Icm0qiuHFqEPA2KVqOxOmLfxz TdO/IS8OwIBTjs9/etpOlRQBFs/59TJkk84E/EGR5qLPYqSXyzicCdzsQ10lF/cTbZGD hTutbjFHNF9sicvvyKUbaN9t9P+JZRXohHxI9tHrXSWctoExXXPizOHgDelaRilq/D4P Na9EVWWgHogvq/mgSMVTPJjJ5Sp8ZI+i0VGKkXTz1zeAhPhbYntym7fZp2b+bbC6Resl YtcQ== 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=CUFHJXNP6ohiRivChPDINRMxOHKnXBAWCJDuEaDGAZE=; fh=ucDtWPXytW+SnEGvX/PD0GC0Q/NUJyLPGeNqbKyEUmo=; b=iUBkkm1M+nU6ydalQH080BcMJaPgDLVXiBOETWxw7+HGpTbr0uVNg0ljQF7JkHmvgm Y73HYU2BU1E1Lh193Z0n90ZE7MIs2t2Y/2Ul8o68vYFLf7VAluit/yLEqcs7vcfSSS/Q 69Y87jFXRfNv56B1YRZjs+d85/3bVoHJgGXKLsElq4aMDaCaOdGg/QBTTBAlJ6SzqzR2 9nuyekuqA0W4ezfZOAc8saztasAdc6DOzo/EOk3wuWFFNmasw8wMxoz6ZADAAB1Pwdaq J9GO5PC5sYkNRibOm+7wJ7H4NG8b9mACTKJVQATucevVgAoEzNLC+KHgK/3ZSksoJkSD pjaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Gzg7iVIh; 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-133321-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s27-20020a50d49b000000b0056e2f95e09dsi786457edi.612.2024.04.05.09.12.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 09:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133321-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Gzg7iVIh; 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-133321-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133321-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7674A1F23B5A for ; Fri, 5 Apr 2024 16:12:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C555C171095; Fri, 5 Apr 2024 16:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gzg7iVIh" Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 5776416ABC3; Fri, 5 Apr 2024 16:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712333566; cv=none; b=oGA9Y7BtyBlBTnhLoHg4Of32F7drTWPPxo5QjhDUbtVM6Sytu9nNBwHvmcvuGCTIVZwHO8WLXl3hyWHSdZIfHUWoZcyUaVZupUl2IpbEek5OFZbBhOCNFyBpMw+WneDuDYmVq+cj9zBh9pKOlmX9ogx29vDqrV6WHF2KZMgWhGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712333566; c=relaxed/simple; bh=rU+WWRBhnpDb+ZVPBQ1akIc9YzS46xtRBAG/iooGCgY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ZLVzsdXAihs1uQWzQIKiqfJnY+aVQ33E2A269uY76EeJH+1zqt/m0J4xsE23wSPtFU0/8DgIKhMwazPVAA649ylUf+J5+hS4PvJ670qN3Gu643wZi9ib7xYw3PEgEVaebAK0CnMg0h3iXD6cOs3ZRMYoqgMHyXuNuR+r6QlO6I0= 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=Gzg7iVIh; arc=none smtp.client-ip=209.85.221.49 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-f49.google.com with SMTP id ffacd0b85a97d-33ff53528ceso1705007f8f.0; Fri, 05 Apr 2024 09:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712333563; x=1712938363; 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=CUFHJXNP6ohiRivChPDINRMxOHKnXBAWCJDuEaDGAZE=; b=Gzg7iVIhHFeDrfYiFc1IgNkzVU2VOm/L2bNquYoeZhBoM2DrG8x+dHVsiDdclE2QDx zOeaKoqnUYP8S80wp9J1ZGtDd8iNf+ATr5bLY2o5XDYG7adDkygUQFJMqCnJmJIobyqg OxOrF4nQFNmM/CnSjf1OQ3tJD/XybkIKlf0/pJHcU9k9k6d6ZWJ9KcpS0P5tvXMrNFXi Qwg0gqTM2tvAChOM4o/ZpudJi/N+0DSFVbHnEZGMGJQObNbPWIzwBo7h81WMILSsdwX9 byY+rTmr6G+zIbRhcDjiZqsuUYyLnVA52kp9fBFuk/tKaCxwqJhhaCuTnF5YGRdRT1hB RdLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712333563; x=1712938363; 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=CUFHJXNP6ohiRivChPDINRMxOHKnXBAWCJDuEaDGAZE=; b=DE7oMu5u1WsS+Xy8cH4C1nClI4YGzIV/s1q0FzVVsRS9D0P/Sv3xof3PTWmZDrMeQi vWHPw/aSflRfIswIsvV9JpIZNTcRxD/2ccqF8JZdQM5Tz9q9mDrtpgb7wtgBf5+lBsjq 7gHCBSU5lTwxNYQFEOf81oDgrcoPOuYtcFiDYMAu6GUCPTKc5uE17tDdKpv0HfSeOHD2 rgv74Xb+YJTBAXvpkV7Kll1GOIUawyr4IndPSeriyCDGwz2X41OxGAsw+Gbx4ch6q3iZ Od47pGGhAh0dBebydXLYnpocjqHRkZVikp6d5Nbelx2GJQOIz80URDFXC7Zf2xocoDCh piCw== X-Forwarded-Encrypted: i=1; AJvYcCUQlMGELGR8LgOpbLCdbX1uVWWJxWaXPnj69Do8+2DbsA7/MNxwIwGzRRiwrBydgTPIb50jCKgz/WHlZaNIyQmJZT+FbVugJhXhrsca0pshig55FdNNjuV7wu6mUnhAZYk3 X-Gm-Message-State: AOJu0YzKHSLhMjFEndzoyeKVGZkKgYZP9XXwjCZH0UjSL/DsMv+VxlKe P43cA6nz2VmYPd6AXEILyv2CBuJZRDU3rGxIkTNrcwnYiNZXTSDvp9c4rihAzHH/7936pBJ1Nja Y3c8dWLiL5UZBrXpDtuCDvIR2Tn4= X-Received: by 2002:a5d:5225:0:b0:341:ba31:b8ba with SMTP id i5-20020a5d5225000000b00341ba31b8bamr1464775wra.57.1712333562610; Fri, 05 Apr 2024 09:12:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <000000000000e9a8d80615163f2a@google.com> <20240403184149.0847a9d614f11b249529fd02@linux-foundation.org> In-Reply-To: From: Alexei Starovoitov Date: Fri, 5 Apr 2024 09:12:31 -0700 Message-ID: Subject: Re: [syzbot] [mm?] BUG: unable to handle kernel paging request in copy_from_kernel_nofault (2) To: "Russell King (Oracle)" , Puranjay Mohan Cc: Mark Rutland , Andrew Morton , linux-arm-kernel , syzbot , LKML , linux-mm , syzkaller-bugs , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 5, 2024 at 4:36=E2=80=AFAM Russell King (Oracle) wrote: > > On Fri, Apr 05, 2024 at 12:02:36PM +0100, Mark Rutland wrote: > > On Thu, Apr 04, 2024 at 03:57:04PM -0700, Alexei Starovoitov wrote: > > > On Wed, Apr 3, 2024 at 6:56=E2=80=AFPM Andrew Morton wrote: > > > > > > > > On Mon, 01 Apr 2024 22:19:25 -0700 syzbot wrote: > > > > > > > > > Hello, > > > > > > > > Thanks. Cc: bpf@vger.kernel.org > > > > > > I suspect the issue is not on bpf side. > > > Looks like the bug is somewhere in arm32 bits. > > > copy_from_kernel_nofault() is called from lots of places. > > > bpf is just one user that is easy for syzbot to fuzz. > > > Interestingly arm defines copy_from_kernel_nofault_allowed() > > > that should have filtered out user addresses. > > > In this case ffffffe9 is probably a kernel address? > > > > It's at the end of the kernel range, and it's ERR_PTR(-EINVAL). > > > > 0xffffffe9 is -0x16, which is -22, which is -EINVAL. > > > > > But the kernel is doing a write? > > > Which makes no sense, since copy_from_kernel_nofault is probe reading= . > > > > It makes perfect sense; the read from 'src' happened, then the kernel t= ries to > > write the result to 'dst', and that aligns with the disassembly in the = report > > below, which I beleive is: > > > > 8: e4942000 ldr r2, [r4], #0 <-- Read of 'src', fault = fixup is elsewhere > > c: e3530000 cmp r3, #0 > > * 10: e5852000 str r2, [r5] <-- Write to 'dst' > > > > As above, it looks like 'dst' is ERR_PTR(-EINVAL). > > > > Are you certain that BPF is passing a sane value for 'dst'? Where does = that > > come from in the first place? > > It looks to me like it gets passed in from the BPF program, and the > "type" for the argument is set to ARG_PTR_TO_UNINIT_MEM. What that > means for validation purposes, I've no idea, I'm not a BPF hacker. > > Obviously, if BPF is allowing copy_from_kernel_nofault() to be passed > an arbitary destination address, that would be a huge security hole. If that's the case that's indeed a giant security hole, but I doubt it. We would be crashing other archs as well. I cannot really tell whether arm32 JIT is on. If it is, it's likely a bug there. Puranjay, could you please take a look.