From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 4ABA73FE364 for ; Thu, 30 Apr 2026 08:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777538505; cv=none; b=t3UJqIw5Vm+z1yliceqmvo1DMtUp/NRJJfcATLehH2H+IMst9hB/FXtRYDtJFBTgKYk2vpoaFX/2zOanFF/u7olhv6wlByAob1YOWqR7MjXcnJ4DO5EPzLyWNxLPrVFa/SlupfLoLHW8nWBCSvOXZ6yzdQaQq7Qta5t2KAn7Nck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777538505; c=relaxed/simple; bh=YTfBXNJOHkEQLmNHuNG/+sg5jsgkk5pjjQgLhX+9u3c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=owTBKxw7WMDS0qqpd3zC2I1FdQ9K8qlmq/ZatBGcjlIxF/JNm4EaAXHHLgW4Q1m73jJZ4JWPAkYdSpBNa52y7eZg9Y+mVGH8lT7lTHibUgcoLOyCY6oN5901XHo+DW8ef16nGvrvBn6C18bcVNaIgmZYkR+20tQCCGWyrOLZ6D8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RquKJJ1i; arc=none smtp.client-ip=209.85.128.74 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--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RquKJJ1i" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-488d9e1e61aso6589405e9.0 for ; Thu, 30 Apr 2026 01:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777538502; x=1778143302; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hSVKX5xpX7DJzb63X7moJdLQaJU2J+xXDx2pgcaTZqE=; b=RquKJJ1i65N8plwCM8vtWQjUJDc/CBrVJYYQpaqxiCPqAeDPduFxI+JkFUGrxkdUmv hWFZ1oCJ+wGacd74Yqzsb9JsiIPzSubEWAH8aOG7NHPIt4SEZwii1HR2rZQ221a/u272 EHFK2axpjRcZdXhwuSCNAi9fF9Jxr+DNVJ+vBG8wuEG92hhU/P2NR8I/MmKkyvrsAPr0 4GXI6ydaGbhCFR2cDSjPZnmVpZIxyVOr/dn7VtOuCbKPRCHqMOBZEoT1a8tZSk3U3iYO v9TxBHAekWZGSy9gci9Hrpw0ET8Ek1rgzwyzEGUTuzohwcU0fAlnMh7Ts7sIOBE4ghMo bHNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777538502; x=1778143302; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hSVKX5xpX7DJzb63X7moJdLQaJU2J+xXDx2pgcaTZqE=; b=UVyKVd4XyA4+OZ+4yM8LcFoA/GHOf0X8TzLn0AExHx7avJTkbY6q6QfRNL+CmI/L0E +HABenU60mszBYMc+y6ZGee7ftcWyOUATTYyk27wPrVQh3LxoRgq6GJIxIWJIKWacvAu mTXHFIDec5AEdim22+TBUNMXmXeVr/THi5OFnyelD13Xe9DOOGjaPB1X76Sc3mtInRxb 0FiPEEipQv8EIAmkb2yPXue19/b74OssAL44/vJzqEc9qv5+E/WD8K78sfz1iB0CxE+J 4yKPnY1uPrbh8ZFdSs1pAdvEwNBx0sVinaEiRA5rECnUdybng4gqfhNa9nkKb8zm7E6c kpQw== X-Forwarded-Encrypted: i=1; AFNElJ8HosuNSj0ijEPzKUqMauN+VXTZ+gyFYjo3nzXaPK5MvayuqpnMAk+PwxzGPzmkuGyCQU5u4DXNbYm/QHI=@vger.kernel.org X-Gm-Message-State: AOJu0Yxm2DPM3IOMF2v+DMXpfboF1E6aA9wSyiHTG8+04qih7tdMgl6H 2yfwcMLgauu09Erl1FjZrCq+ABWyKXF1x19MS7NfbmzL/2MxMo2JvrpY1pC7LgL+8Hgdluyemm0 ulHiVNO1e5bg2iUafQw== X-Received: from wmgi12.prod.google.com ([2002:a05:600c:2d8c:b0:48a:58a1:abd4]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3f0a:b0:488:ae6c:42c6 with SMTP id 5b1f17b1804b1-48a84445b3dmr34533605e9.14.1777538502473; Thu, 30 Apr 2026 01:41:42 -0700 (PDT) Date: Thu, 30 Apr 2026 08:41:41 +0000 In-Reply-To: <20260430071930.73696-1-sagartaunk2@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260430071930.73696-1-sagartaunk2@gmail.com> Message-ID: Subject: Re: [PATCH v2] rust: workqueue: replace SAFETY TODO for `WorkItemPointer` impl on `Pin>` From: Alice Ryhl To: Sagar Taunk Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Tamir Duberstein , Daniel Almeida , Viresh Kumar , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Thu, Apr 30, 2026 at 12:49:28PM +0530, Sagar Taunk wrote: > The original implementation left a `SAFETY: TODO` comment on the > `WorkItemPointer` implementation for `Pin>`. This patch documents > the safety requirements that make this implementation sound. > > The safety argument follows the same structure as the `Arc` > implementation and relies on three guarantees: > `__enqueue` strips the `Pin` wrapper via `Pin::into_inner_unchecked` > and leaks the box via `KBox::into_raw`, producing `*mut T` whose > allocation remains live for the duration of the queued work; > `work_container_of` safely reverses the `raw_get_work` offset arithmetic to > recover the exact `*mut T` that `__enqueue` produced; and the workqueue > guarantees `run` is called exactly once, making `KBox::from_raw` sound. > > Signed-off-by: Sagar Taunk Thanks Reviewed-by: Alice Ryhl