Re: [PATCH] cpufreq: refactor deprecated strncpy

2023-09-27 Thread Viresh Kumar
On 13-09-23, 00:07, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > We should prefer more robust and less ambiguous string interfaces. > > Both `policy->last_governor` and `default_governor` are expected to be > NUL-terminated which is shown by

Re: [PATCH] cxl/acpi: Annotate struct cxl_cxims_data with __counted_by

2023-09-27 Thread Justin Stitt
On Sat, Sep 23, 2023 at 2:53 AM Kees Cook wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexin

Re: [PATCH] hte: Annotate struct hte_device with __counted_by

2023-09-27 Thread Justin Stitt
On Sat, Sep 23, 2023 at 2:54 AM Kees Cook wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexin

Re: [PATCH] hte: Annotate struct hte_device with __counted_by

2023-09-27 Thread Dipen Patel
On 9/23/23 9:37 AM, Gustavo A. R. Silva wrote: > > > On 9/22/23 11:53, Kees Cook wrote: >> Prepare for the coming implementation by GCC and Clang of the __counted_by >> attribute. Flexible array members annotated with __counted_by can have >> their accesses bounds-checked at run-time checking via

Re: [PATCH] cxl/acpi: Annotate struct cxl_cxims_data with __counted_by

2023-09-27 Thread Davidlohr Bueso
On Fri, 22 Sep 2023, Kees Cook wrote: Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTI

Re: [PATCH] soc: qcom: smem: Annotate struct qcom_smem with __counted_by

2023-09-27 Thread Bjorn Andersson
On Fri, 22 Sep 2023 10:54:14 -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array inde

Fwd: Performance regression: resume_console takes 100ms longer in S2idle/S3 resume in v6.6-rc1

2023-09-27 Thread Bagas Sanjaya
Hi, I notice a regression report on Bugzilla [1]. Quoting from it: > Ever since 6.6.0-rc1 we've seen S3 and S2idle resume take 100ms longer > because of resume_comsole. resume_console ordinarily takes only a few > milliseconds, but now it's consistently 100ms. I've bisected the issue to > this

Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-09-27 Thread Al Viro
On Tue, Sep 26, 2023 at 10:25:15PM +0100, Al Viro wrote: > Before your patch: foo_kill_super() calls kill_anon_super(), > which calls kill_super_notify(), which removes the sucker from > the list, then frees ->s_fs_info. After your patch: > removal from the lists happens via the call of kill_supe

Re: [PATCH v3 3/4] binfmt_elf: Provide prot bits as context for padzero() errors

2023-09-27 Thread Eric W. Biederman
Kees Cook writes: > Errors with padzero() should be caught unless we're expecting a > pathological (non-writable) segment. Report -EFAULT only when PROT_WRITE > is present. > > Additionally add some more documentation to padzero(), elf_map(), and > elf_load(). I wonder if this might be easier to

Re: [PATCH v3 0/4] binfmt_elf: Support segments with 0 filesz and misaligned starts

2023-09-27 Thread Eric W. Biederman
Kees Cook writes: > Hi, > > This is the continuation of the work Eric started for handling > "p_memsz > p_filesz" in arbitrary segments (rather than just the last, > BSS, segment). I've added the suggested changes: > > - drop unused "elf_bss" variable > - report padzero() errors when PROT_WRITE

Re: [Intel-wired-lan] [PATCH net-next v5 0/7] introduce DEFINE_FLEX() macro

2023-09-27 Thread Tony Nguyen
On 9/19/2023 4:10 AM, Przemek Kitszel wrote: On 9/12/23 18:16, Kees Cook wrote: On Tue, Sep 12, 2023 at 07:59:30AM -0400, Przemek Kitszel wrote: Add DEFINE_FLEX() macro, that helps on-stack allocation of structures with trailing flex array member. Expose __struct_size() macro which reads siz

Re: [PATCH 00/14] Batch 1: Annotate structs with __counted_by

2023-09-27 Thread Kees Cook
On Fri, Sep 22, 2023 at 10:28:42AM -0700, Kees Cook wrote: > This is the batch 1 of patches touching netdev for preparing for > the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at

Re: [PATCH] scsi: target: tcmu: Annotate struct tcmu_tmr with __counted_by

2023-09-27 Thread Martin K. Petersen
Kees, > Prepare for the coming implementation by GCC and Clang of the > __counted_by attribute. Flexible array members annotated with > __counted_by can have their accesses bounds-checked at run-time > checking via CONFIG_UBSAN_BOUNDS (for array indexing) and > CONFIG_FORTIFY_SOURCE (for strcpy/

Re: [PATCH v3] hwmon: refactor deprecated strncpy

2023-09-27 Thread Justin Stitt
On Wed, Sep 27, 2023 at 11:05 PM Justin Stitt wrote: > > On Wed, Sep 27, 2023 at 9:49 PM Guenter Roeck wrote: > > > > On Thu, Sep 21, 2023 at 05:41:46AM +, Justin Stitt wrote: > > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > > > > > Let's refactor this kcal

Re: [PATCH v3] hwmon: refactor deprecated strncpy

2023-09-27 Thread Justin Stitt
On Wed, Sep 27, 2023 at 9:49 PM Guenter Roeck wrote: > > On Thu, Sep 21, 2023 at 05:41:46AM +, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > > > Let's refactor this kcalloc() + strncpy() into a kmemdup_nul() which has > > more obvious be

Re: [PATCH] bus: vexpress-config: Annotate struct vexpress_syscfg_func with __counted_by

2023-09-27 Thread Sudeep Holla
On Fri, 22 Sep 2023 10:52:35 -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexi

Re: [PATCH v3] hwmon: refactor deprecated strncpy

2023-09-27 Thread Guenter Roeck
On Thu, Sep 21, 2023 at 05:41:46AM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > Let's refactor this kcalloc() + strncpy() into a kmemdup_nul() which has > more obvious behavior and is less error prone. > > To avoid truncating the last

Re: [PATCH] mmc: vub300: replace deprecated strncpy with strscpy

2023-09-27 Thread Ulf Hansson
gt; retval = request_firmware(&fw, vub300->vub_name, &card->dev); > if (retval < 0) { > - strncpy(vub300->vub_name, > + strscpy(vub300->vub_name, > "no SDIO offload firmware found", > sizeof(vub300->vub_name)); > } else { > @@ -1758,7 +1758,7 @@ static void vub300_cmndwork_thread(struct work_struct > *work) > * has been already downloaded to the VUB300 chip > */ > } else if (0 == vub300->mmc->card->sdio_funcs) { > - strncpy(vub300->vub_name, "SD memory device", > + strscpy(vub300->vub_name, "SD memory device", > sizeof(vub300->vub_name)); > } else { > download_offload_pseudocode(vub300); > > --- > base-commit: 6465e260f48790807eef06b583b38ca9789b6072 > change-id: 20230927-strncpy-drivers-mmc-host-vub300-c-b7b39f82e584 > > Best regards, > -- > Justin Stitt >

Re: [PATCH] pinctrl: uniphier: Annotate struct uniphier_pinctrl_reg_region with __counted_by

2023-09-27 Thread Linus Walleij
On Fri, Sep 22, 2023 at 7:50 PM Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexing