Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp3836352rwb; Sun, 30 Jul 2023 17:45:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlHAZf8P21bqCDPMxuaM5JP/suM9ILCzlOOB3vz+MTIiXla14m+KLabfVlm250faKPLPoRBK X-Received: by 2002:a05:6358:5e0a:b0:133:b42:69ca with SMTP id q10-20020a0563585e0a00b001330b4269camr4400342rwn.18.1690764348088; Sun, 30 Jul 2023 17:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690764348; cv=none; d=google.com; s=arc-20160816; b=CyRM2mXEnfgo7peTL/mx3LDAxw5LJGtWh0Z7S0/tkPq8Q2WSs+tv2yWTjmAzCp/u4k 1G//1XwxcZJnr7AU40kfZ186WJdJJwSShtU3HtqJj3N0mBOh1WGmRY7A4l5Yxccl33jP K41jukB5ozo9LGo8kiOvVwdtHNVqORxCjVVNCQNMf8HZDo/2aYJwZ9RJDTqqgX8pzhxT werxAs9W0GkUECg1s75R7VIXiL8gV+BBz9H54kGXOYfEJvj/Hq/P84kKE69EqiddsOjL dgbk5v7GIGNzfd5T3e1VzLG78aKMIOhxQszIVi0YlogBmrUfOCTp1eTZuVVinzjDgwxt gntA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=7noDWhw9qbH9bbmDZ+mnoEvlUKMZe2LiLK48dmHENgQ=; fh=ZzRiKFGQ22TfIsgfvdACHq4kp4ukKa0Qe2gdjJMLLXE=; b=nd00Aleylv5v2r9JxlbuXDPeixEXv3o5inu16mS5ZAzAPUdi00VZ0a9p2rr5pCot8R IIpHkluBIFbBc9r4X5puw8diNMU7MAjrYmrPh1UHkIbeTzqD7fPklWmIJg21qWbd6bhh Yhv05/kmmf4Sbv5vyqd6Rt2PYLni2ZvUJV3rXYLwknvXTQxejZ1tx21bXfy4xkeAFMgw RD31DkHyR6ax+VPNaFm8yZRsP3QAqv4gpHvwysYwvx6eLl3HFnR9xlO1dUNuQSFcU8RD 3sIRctN6HPDTBtQz7YnMiIFgD8GHdQBihwEh6s2iVw2JkRAwDqZXIj1s+PfDVY0EE2DM BKhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=RNr9dgZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170903230100b001b8af83d939si6766261plh.537.2023.07.30.17.45.36; Sun, 30 Jul 2023 17:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=RNr9dgZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229379AbjG3WmM (ORCPT + 99 others); Sun, 30 Jul 2023 18:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjG3WmL (ORCPT ); Sun, 30 Jul 2023 18:42:11 -0400 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE3BAB; Sun, 30 Jul 2023 15:42:09 -0700 (PDT) Date: Sun, 30 Jul 2023 22:41:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1690756925; x=1691016125; bh=7noDWhw9qbH9bbmDZ+mnoEvlUKMZe2LiLK48dmHENgQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=RNr9dgZfi9jyPH/0Rrer91IoUFSMoz9Yf2Fj+jW55M4HxSuzalwr2Vt+xpBSbdGjP 2rUSV8LoZ9T5siafIa7w8ou6oWg72zJgi4oKjV+ztzZwKA5YUc3R7r6bgYULsgAaqp bSz4PS3wYtR8JQt/69+7Jy/zPXT/l18fTFe6LzhaARWS8YBLqpeUxqhzJeDAwOrrzs rcrqTO6cWHOJ6K/FAo++rYvaPgC1HLOjk9Y5wGjIajNDlXPdombk7rZ9U6WNUhMrtt sAagJVB7Jnt34fR3tKC7SPSVvLlB1zUepcJpCqiSxDNS544MZwrn9I+ML6TIIuoC+P ke2hdW/c5iSKw== To: Miguel Ojeda From: =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= Cc: Boqun Feng , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , Benno Lossin , Martin Rodriguez Reboredo , Alice Ryhl , Dariusz Sosnowski , Geoffrey Thomas , Fox Chen , John Baublitz , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Kees Cook , stable@vger.kernel.org, Andreas Hindborg Subject: Re: [PATCH 1/3] rust: allocator: Prevent mis-aligned allocation Message-ID: In-Reply-To: References: <20230730012905.643822-1-boqun.feng@gmail.com> <20230730012905.643822-2-boqun.feng@gmail.com> Feedback-ID: 27884398:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Jul 30, 2023, 10:43 PM, Miguel Ojeda < miguel.ojeda.sandonis@gmail.com> = wrote: > On Sun, Jul 30, 2023 at 3:29=E2=80=AFAM Boqun > Feng wrote: > > > > +// Note: Although these are *safe* functions, but they are only genera= ted at > > +// `GlobalAlloc` callsites, hence we assume the parameters obey the sa= me > > +// `GlobalAlloc` function safety requirements: size and align should f= orm a > > +// valid layout, and size is greater than 0. > > Thanks for adding all the `// SAFETY` comments here Boqun! > > Bj=C3=B6rn, do they look good to you? (since you fixed the issue in the c= ompiler) Based on a quick look, yes. The __rust_* methods that are normally generate= d by the compiled directly jump to the respective global allocator method, = so they have the same safety requirements. > > On this comment in particular, "generated at `GlobalAlloc` callsites" sounds a bit confusing to me. Would "... called by the compiler with parameters that obey ..." make sense? Or does the sentence refer to the normal case (i.e. when the functions are generated)? Anyway, it is not a big deal. > > Cheers, > Miguel Cheers, Bj=C3=B6rn (resent as I accidentally sent html instead of plain text)