From nobody Fri Jul 24 22:17:36 2026 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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 2EDE943F4AF for ; Wed, 22 Jul 2026 21:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784754645; cv=none; b=qIHfWFPWyNZQhROb8+lFGYs0s+IPiwRtvAoYB1CawDqBgN7w8QI2l9lhthSYUNQ+Qbvh/TLktUHrr4UtrKqvAl/T2ak51Nc86IzEyij2UQza5+6KG83HrKHnD209y5srqWZXm8Vr3pdAjO23HnKP/HRZzkaLmciP5NXd7J3IZkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784754645; c=relaxed/simple; bh=mW1kuA1EBweMGGAL7F7Bl9RcI8jlBsmE+i4of+8Lp+Y=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=sw7/rRGb8bH3WwjJCqCDOyOtbwqupHP2v/dluvniH49OE2s6qUoWSTGQwb3HgkH8ThK4ZZlb2LZjmkJx7IVE0f3n2L8pkB6aHTtAQEJtE27ohSslAU4oNALocK4DT8nAKNWhFEklh8gGGnHbsB0Rf7+p2FzvMGyXdhm6n/mK2Gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tjmercier.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HDEway+S; arc=none smtp.client-ip=209.85.210.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tjmercier.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HDEway+S" Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8487ed7f7beso9514458b3a.0 for ; Wed, 22 Jul 2026 14:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784754642; x=1785359442; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zGCjZgrYR7q/NtwUSDt7c4X9W2mt8hvcEDv9J7cv/8U=; b=HDEway+SbT3VsK4+TrmAl7EuOgT8pD44vmBTwmz7qec06OecA5tisqtlOSXB40FoeT ApTOO4zUvf4IW+DqWogwu40CtuWZrfsQSojuBtz5MQwFUAXLTKe1W0NjXgZgBqedkDte 2i2ExZA8QA6IYn4FmouwTmygsbYi62+PUQEvian/A3mUJjyVEKGWMG6hR+9XL+CcUzaZ 4s/5v82tVbufHVFwnfAUC8HbZ+jGb9x8Rej5GJJH2jrx4s3axoaXE0IRzupsdZCnwFSn XC/fGFm1Inry+Gwi8OGRDEUwVhyVLlYNtM81uPZO13l1J80KzsGowdgBeG3DoYEk65Ik XI+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784754642; x=1785359442; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zGCjZgrYR7q/NtwUSDt7c4X9W2mt8hvcEDv9J7cv/8U=; b=gDrKdugqvg0jml+9JXD9PJDQVPJwE00m5WtDjqGvH2UiNMV3V4mWNgGG24xtK+7Xkx fdJ0rAo1d0xMVUjzcskgH4OVBXNn5L6qk9CpybhqfpeO5vE65WH7qdzj/9Ej5ZeTcqiF lCrc/kN0fAlsOMLVPKG35MqXabvPB+CbyqIkiaPok65idN7pBGVDQcIhMVhHG8b3Y8qG ohM5DEuqfnDtxo936JRjZshQBpOS2sJmYFwQukdMBDCx/SbWvUAFHT1F/gFIIfJARqf6 GHi5b5/4AGjtIcmS8xfE/By5ZMPL/eobx0D297UrT0AECcDuNQ9nhn6F2cYnlUa6DqzT IxqQ== X-Forwarded-Encrypted: i=1; AHgh+Roxguu21P8PzA3pMUrDeLFLgAPlP95PKDybJzthER8O03YktXCT1Enx9d/mCknrKjk/qndtko5PhACive4=@vger.kernel.org X-Gm-Message-State: AOJu0YwALIvqo+4v3yRpVpM4+LhHolUnVNZ2eoaMKKLJLxgwd7BFePUu nsS5NuGohR1Gb6UGmql68rnsZmlJzwjGzUHisaTLBnpIwMyVxG6ROD2ukYj8/Ui47WYzDNOSAOd gW4Nv2Vt0eN1A70PtAw== X-Received: from pfbdf3.prod.google.com ([2002:a05:6a00:4703:b0:848:81e8:f2d9]) (user=tjmercier job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:94e7:b0:84e:936:4673 with SMTP id d2e1a72fcca58-84e2bc28e55mr541942b3a.70.1784754642173; Wed, 22 Jul 2026 14:10:42 -0700 (PDT) Date: Wed, 22 Jul 2026 14:10:37 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260722211037.1925308-1-tjmercier@google.com> Subject: [PATCH v3] selftests/udmabuf: Open /dev/udmabuf O_RDONLY From: "T.J. Mercier" To: kraxel@redhat.com, vivek.kasireddy@intel.com, shuah@kernel.org, skhan@linuxfoundation.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, bobbyeshleman@meta.com, kuba@kernel.org, "T.J. Mercier" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Write permissions on the /dev/udmabuf device file are not required to issue ioctls and allocate udmabufs. Applications should be opening this file as O_RDONLY. The BPF dmabuf_iter selftest already does this. [1] Users are pointing to these selftests as examples of how use udmabuf, and encountering permission errors on systems where write permissions are not available on /dev/udmabuf. Apply the principle of least privilege to selftests which use udmabuf by removing the write access mode from drivers/dma-buf/udmabuf.c and drivers/net/hw/ncdevmem.c. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c?h=3Dv7.1#n49 Signed-off-by: T.J. Mercier Reviewed-by: Bobby Eshleman --- tools/testing/selftests/drivers/dma-buf/udmabuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/test= ing/selftests/drivers/dma-buf/udmabuf.c index d78aec662586..ced0b95c876c 100644 --- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c +++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) ksft_print_header(); ksft_set_plan(7); =20 - devfd =3D open("/dev/udmabuf", O_RDWR); + devfd =3D open("/dev/udmabuf", O_RDONLY); if (devfd < 0) { ksft_print_msg( "%s: [skip,no-udmabuf: Unable to access DMA buffer device file]\n", base-commit: 20f01a5565ce79923b75a2ac8e8ef2a1d7adf517 --=20 2.55.0.229.g6434b31f56-goog