Message ID | 20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c-v1-1-37afcf4964d9@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5153180vqi; Thu, 21 Sep 2023 14:36:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFahY0Fuu9bVyKWcsmXOEpoZSuQMPO3jnu+RQh31tuaFL8NtaYa+ZvYNKHHE9gWgJ5cR1DY X-Received: by 2002:a17:903:120b:b0:1bc:2c83:f770 with SMTP id l11-20020a170903120b00b001bc2c83f770mr7158656plh.45.1695332172526; Thu, 21 Sep 2023 14:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695332172; cv=none; d=google.com; s=arc-20160816; b=rZTkKLDj4e+eMyXLidYkyp/0/5KZlg7qwTlboX3yXHLbqGDgbK5l8LeiPkwztFnJw0 m5Dk81843NSaxnU65LgeQ+hF1G1egw2shhsUu8uoEGBbElEOXKO942GEVzgjjOVc0kdm ED5VvIZPs8JrQIshfcFWimTeerPIDJFbuIGK399kAT8c/uA/8cWHOVPpWEpPlm9S2MhX B389yonqoz+me9gV/z8t0ROFMrRI0aoS3hnTXfgpMcXaa3FYcJGWpvXrtUa/tZl79/Vw Gg/r1m7RLaGqUCiMI7PXHkEo4qaFuuwQ9AUmRMM7VOlGPh4VfA6qCntfsLdwY4VE0LQC B8mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=uEYxgEiQ2G0lBnnvjz69oKH6w7GyE7puCJV+/rYXSPI=; fh=Du6LaqmSbX/L0lRBu7+9mJtYs+JHNh3Qn9UVZMoEs5I=; b=mXYUh/VGvEIAzMcqIv0EMzJKFbJzYsO3/STAhU4MyNM3MEXyIA0U7/q6kTc+luUfsY 9gfg7dmREGjNeiuXd9OnrGScKUcXjrDI02M3mjegu2hL4ERfgMEE3Xg86/mGt0NlLEEQ 3FJ8KIjQlEKeN1h2j1iCEIxdHVFUKZLUhtqJE07ScydZg9oKtJvZr6RWDDvvmi1r6SuA Q0pviCjAOdX7ilqFv7AlGC9GF/6+ihEfltMG6um/Gbi/2aiF95Y37ybbcl/iGfrk+0gz NRx8x+R+ytelkYtYxqxyyV2HLomfw/9RDgsF3MGUQYuoHaTt8eMGhZU4WAa23dZKNqt6 VyVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k5QCvOgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id kq11-20020a170903284b00b001c34abf9f2esi2208385plb.110.2023.09.21.14.36.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 14:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k5QCvOgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 310AF83524C9; Thu, 21 Sep 2023 12:04:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbjIUTEO (ORCPT <rfc822;ruipengqi7@gmail.com> + 28 others); Thu, 21 Sep 2023 15:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbjIUTD5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 21 Sep 2023 15:03:57 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686A6880B3 for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 10:51:50 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59bfccec7f3so18615337b3.2 for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 10:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695318708; x=1695923508; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=uEYxgEiQ2G0lBnnvjz69oKH6w7GyE7puCJV+/rYXSPI=; b=k5QCvOgA7I4XAm56OivfNsDesUKGumTK59ZYFdORCk1bSRrEAr825CG2wyJ9u62UbX mmPgdzxVX45Ex4gzd/Z6398DgWyZq8nZNHttqw6gFau8CubmHI0zKeWk20GSiqKYM8vP t3wsFfqzPrQj4xKTImJg6fFk14fVMrFsn8uT0WzC26wonKiVRreo6rPeoNzKW2L8XfJQ D/mTIcp/HbYPF0DTn/J2hyMOp4awbw4HFJgAz0irtXskru6gm/LpkAKOx+/pFxp6Jl4T 41l/KHH4+kuZb6eq6CqTkZ4FxOyLJkp0lHpbmUg+1tc474TSDwP2g0YHjygBzeY3ISyc gvFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695318708; x=1695923508; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uEYxgEiQ2G0lBnnvjz69oKH6w7GyE7puCJV+/rYXSPI=; b=kDoUy2t4YnINlRUyUxc8idvIhFLMWwQgPsiPK/JVus6d04TYbczu/8V4x8HIO7qtIp ZlHBt9rjB5sgIAEWQHCQPw/dDDEhfqYBbJkjPrtRMdpZpJrAYo3N5Wr6/H5hlrLP8Vif t79Zr+/KuxHCvEl5EAIox5oeb/wxMkZWNv4p05vslGzz0JoBz71iMHJhZI0pmiePQ3TM naJLeTzqncESbaonjpHlrKBy7pV2FHIcMDur6V+S7MdarfK/RcL7tQ1EJSdRUIUQEktq ndHHQV9YoPtIycohpqGDQAiou1T4GGW/PdmEJMYQn/tgEDuqq6609KPkeqScJclbPGLo XMJQ== X-Gm-Message-State: AOJu0Ywxzdbu6YAdMuifr67n0FaUTudIz2ZEStab8m0EzLl96Ei8ghFx rNHp5eGEfMHltJi5UxU3dF5V4t1vTNiPz+a1Jw== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a25:ac1f:0:b0:d78:a78:6fc7 with SMTP id w31-20020a25ac1f000000b00d780a786fc7mr62541ybi.6.1695280667831; Thu, 21 Sep 2023 00:17:47 -0700 (PDT) Date: Thu, 21 Sep 2023 07:17:47 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIABruC2UC/x3NQQrCMBBG4auUWTuQVFuoVxEXaTIx/2YME6lK6 d0NLr/Nezs1MUij67CTyYaGp3b400CxBH0II3XT6MazW0bP7WUa65eTYRNrDM1QrEETlzeXDM+ xoHLkaV0kzG6SOV6o96pJxuf/ut2P4wcSjWpSewAAAA== X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1695280667; l=2643; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=gl6rbcY5JocGZdujGLJVeAlqntg2FcLChTBuwnqHH7U=; b=NicE4L8AAk6eGWezYObrbvJqP3acl0HC36VETSmVRV4fbfv1RZmywz56MTfFRfbzVnUQx8JQ0 ApR6UamY9EhBv4sAizOSMNlKCNEyUY1P3vMSPVFbgvy6kATdgL3JIiI X-Mailer: b4 0.12.3 Message-ID: <20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c-v1-1-37afcf4964d9@google.com> Subject: [PATCH] IB/hfi1: replace deprecated strncpy From: Justin Stitt <justinstitt@google.com> To: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>, Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org> Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Justin Stitt <justinstitt@google.com> Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=DATE_IN_PAST_06_12, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:04:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777684627955948098 X-GMAIL-MSGID: 1777684627955948098 |
Series |
IB/hfi1: replace deprecated strncpy
|
|
Commit Message
Justin Stitt
Sept. 21, 2023, 7:17 a.m. UTC
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.
We see that `buf` is expected to be NUL-terminated based on it's use
within a trace event wherein `is_misc_err_name` and `is_various_name`
map to `is_name` through `is_table`:
| TRACE_EVENT(hfi1_interrupt,
| TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry,
| int src),
| TP_ARGS(dd, is_entry, src),
| TP_STRUCT__entry(DD_DEV_ENTRY(dd)
| __array(char, buf, 64)
| __field(int, src)
| ),
| TP_fast_assign(DD_DEV_ASSIGN(dd);
| is_entry->is_name(__entry->buf, 64,
| src - is_entry->start);
| __entry->src = src;
| ),
| TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf,
| __entry->src)
| );
Considering the above, a suitable replacement is `strscpy_pad` due to
the fact that it guarantees NUL-termination on the destination buffer
while maintaining the NUL-padding behavior that strncpy provides.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
Note: build-tested
---
drivers/infiniband/hw/hfi1/chip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 2cf0f715623872823a72e451243bbf555d10d032
change-id: 20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c-5b9ea605e6c4
Best regards,
--
Justin Stitt <justinstitt@google.com>
Comments
On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We see that `buf` is expected to be NUL-terminated based on it's use > within a trace event wherein `is_misc_err_name` and `is_various_name` > map to `is_name` through `is_table`: > | TRACE_EVENT(hfi1_interrupt, > | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, > | int src), > | TP_ARGS(dd, is_entry, src), > | TP_STRUCT__entry(DD_DEV_ENTRY(dd) > | __array(char, buf, 64) > | __field(int, src) > | ), > | TP_fast_assign(DD_DEV_ASSIGN(dd); > | is_entry->is_name(__entry->buf, 64, > | src - is_entry->start); > | __entry->src = src; > | ), > | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, > | __entry->src) > | ); > > [...] Applied, thanks! [1/1] IB/hfi1: replace deprecated strncpy https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 Best regards,
On 9/22/2023 5:29 AM, Leon Romanovsky wrote: > > On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: >> `strncpy` is deprecated for use on NUL-terminated destination strings >> [1] and as such we should prefer more robust and less ambiguous string >> interfaces. >> >> We see that `buf` is expected to be NUL-terminated based on it's use >> within a trace event wherein `is_misc_err_name` and `is_various_name` >> map to `is_name` through `is_table`: >> | TRACE_EVENT(hfi1_interrupt, >> | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, >> | int src), >> | TP_ARGS(dd, is_entry, src), >> | TP_STRUCT__entry(DD_DEV_ENTRY(dd) >> | __array(char, buf, 64) >> | __field(int, src) >> | ), >> | TP_fast_assign(DD_DEV_ASSIGN(dd); >> | is_entry->is_name(__entry->buf, 64, >> | src - is_entry->start); >> | __entry->src = src; >> | ), >> | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, >> | __entry->src) >> | ); >> >> [...] > > Applied, thanks! It is unfortunate that this and the qib patch was accepted so quickly. The replacement is functionally correct. However, I was going to suggest using strscpy() since the return value is never looked at and all use cases only require a NUL-terminated string. Padding is not needed. > > [1/1] IB/hfi1: replace deprecated strncpy > https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 > > Best regards, External recipient
On Fri, Sep 22, 2023 at 09:25:39AM -0500, Dean Luick wrote: > On 9/22/2023 5:29 AM, Leon Romanovsky wrote: > > > > On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: > >> `strncpy` is deprecated for use on NUL-terminated destination strings > >> [1] and as such we should prefer more robust and less ambiguous string > >> interfaces. > >> > >> We see that `buf` is expected to be NUL-terminated based on it's use > >> within a trace event wherein `is_misc_err_name` and `is_various_name` > >> map to `is_name` through `is_table`: > >> | TRACE_EVENT(hfi1_interrupt, > >> | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, > >> | int src), > >> | TP_ARGS(dd, is_entry, src), > >> | TP_STRUCT__entry(DD_DEV_ENTRY(dd) > >> | __array(char, buf, 64) > >> | __field(int, src) > >> | ), > >> | TP_fast_assign(DD_DEV_ASSIGN(dd); > >> | is_entry->is_name(__entry->buf, 64, > >> | src - is_entry->start); > >> | __entry->src = src; > >> | ), > >> | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, > >> | __entry->src) > >> | ); > >> > >> [...] > > > > Applied, thanks! > > It is unfortunate that this and the qib patch was accepted so quickly. The replacement is functionally correct. However, I was going to suggest using strscpy() since the return value is never looked at and all use cases only require a NUL-terminated string. Padding is not needed. Is the trace buffer already guaranteed to be zeroed? Since this is defined as a fixed-size string in the buffer, it made sense to me to be sure that the unused bytes were 0 before copying them to userspace. -Kees > > > > > [1/1] IB/hfi1: replace deprecated strncpy > > https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 > > > > Best regards, > > External recipient
On 9/23/2023 10:20 PM, Kees Cook wrote: > On Fri, Sep 22, 2023 at 09:25:39AM -0500, Dean Luick wrote: >> On 9/22/2023 5:29 AM, Leon Romanovsky wrote: >>> >>> On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: >>>> `strncpy` is deprecated for use on NUL-terminated destination strings >>>> [1] and as such we should prefer more robust and less ambiguous string >>>> interfaces. >>>> >>>> We see that `buf` is expected to be NUL-terminated based on it's use >>>> within a trace event wherein `is_misc_err_name` and `is_various_name` >>>> map to `is_name` through `is_table`: >>>> | TRACE_EVENT(hfi1_interrupt, >>>> | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, >>>> | int src), >>>> | TP_ARGS(dd, is_entry, src), >>>> | TP_STRUCT__entry(DD_DEV_ENTRY(dd) >>>> | __array(char, buf, 64) >>>> | __field(int, src) >>>> | ), >>>> | TP_fast_assign(DD_DEV_ASSIGN(dd); >>>> | is_entry->is_name(__entry->buf, 64, >>>> | src - is_entry->start); >>>> | __entry->src = src; >>>> | ), >>>> | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, >>>> | __entry->src) >>>> | ); >>>> >>>> [...] >>> >>> Applied, thanks! >> >> It is unfortunate that this and the qib patch was accepted so quickly. The replacement is functionally correct. However, I was going to suggest using strscpy() since the return value is never looked at and all use cases only require a NUL-terminated string. Padding is not needed. > > Is the trace buffer already guaranteed to be zeroed? Since this is > defined as a fixed-size string in the buffer, it made sense to me to be > sure that the unused bytes were 0 before copying them to userspace. I was not aware that binary trace records were exposed to user space. If so, and the event records are not zeroed (either the buffer as a whole, or individual records), then strscpy_pad() is the correct solution. My quick review of the tracing system suggests that nothing is zeroed and the record is embedded in a larger structure. However, this begs the question for all users of tracing: Aren't alignment holes in the fast assign record a leak? -Dean > > -Kees > >> >>> >>> [1/1] IB/hfi1: replace deprecated strncpy >>> https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 >>> >>> Best regards, >> >> External recipient > External recipient
On Tue, Sep 26, 2023 at 07:56:34AM -0500, Dean Luick wrote: > On 9/23/2023 10:20 PM, Kees Cook wrote: > > On Fri, Sep 22, 2023 at 09:25:39AM -0500, Dean Luick wrote: > >> On 9/22/2023 5:29 AM, Leon Romanovsky wrote: > >>> > >>> On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: > >>>> `strncpy` is deprecated for use on NUL-terminated destination strings > >>>> [1] and as such we should prefer more robust and less ambiguous string > >>>> interfaces. > >>>> > >>>> We see that `buf` is expected to be NUL-terminated based on it's use > >>>> within a trace event wherein `is_misc_err_name` and `is_various_name` > >>>> map to `is_name` through `is_table`: > >>>> | TRACE_EVENT(hfi1_interrupt, > >>>> | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, > >>>> | int src), > >>>> | TP_ARGS(dd, is_entry, src), > >>>> | TP_STRUCT__entry(DD_DEV_ENTRY(dd) > >>>> | __array(char, buf, 64) > >>>> | __field(int, src) > >>>> | ), > >>>> | TP_fast_assign(DD_DEV_ASSIGN(dd); > >>>> | is_entry->is_name(__entry->buf, 64, > >>>> | src - is_entry->start); > >>>> | __entry->src = src; > >>>> | ), > >>>> | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, > >>>> | __entry->src) > >>>> | ); > >>>> > >>>> [...] > >>> > >>> Applied, thanks! > >> > >> It is unfortunate that this and the qib patch was accepted so quickly. The replacement is functionally correct. However, I was going to suggest using strscpy() since the return value is never looked at and all use cases only require a NUL-terminated string. Padding is not needed. > > > > Is the trace buffer already guaranteed to be zeroed? Since this is > > defined as a fixed-size string in the buffer, it made sense to me to be > > sure that the unused bytes were 0 before copying them to userspace. > > I was not aware that binary trace records were exposed to user space. If so, and the event records are not zeroed (either the buffer as a whole, or individual records), then strscpy_pad() is the correct solution. My quick review of the tracing system suggests that nothing is zeroed and the record is embedded in a larger structure. However, this begs the question for all users of tracing: Aren't alignment holes in the fast assign record a leak? I thought they were passed over direct to userspace somehow, but I haven't looked at the details in a long time. I could very well be misunderstanding it.
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index 0814291a0412..7b8e1456284f 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c @@ -5334,7 +5334,7 @@ static const char * const cce_misc_names[] = { static char *is_misc_err_name(char *buf, size_t bsize, unsigned int source) { if (source < ARRAY_SIZE(cce_misc_names)) - strncpy(buf, cce_misc_names[source], bsize); + strscpy_pad(buf, cce_misc_names[source], bsize); else snprintf(buf, bsize, "Reserved%u", source + IS_GENERAL_ERR_START); @@ -5374,7 +5374,7 @@ static const char * const various_names[] = { static char *is_various_name(char *buf, size_t bsize, unsigned int source) { if (source < ARRAY_SIZE(various_names)) - strncpy(buf, various_names[source], bsize); + strscpy_pad(buf, various_names[source], bsize); else snprintf(buf, bsize, "Reserved%u", source + IS_VARIOUS_START); return buf;