Re: [PATCH v2 49/63] btrfs: Use memset_startat() to clear end of struct

2021-08-17 Thread Nikolay Borisov
On 18.08.21 г. 9:05, Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field bounds checking for memset(), avoid intentionally writing across > neighboring fields. > > Use memset_startat() so memset() doesn't get confused about writing > beyond the dest

Re: [PATCH v8 21/34] mtd: rawnand: tegra: Add runtime PM and OPP support

2021-08-17 Thread Miquel Raynal
Hi Dmitry, Dmitry Osipenko wrote on Tue, 17 Aug 2021 04:27:41 +0300: > The NAND on Tegra belongs to the core power domain and we're going to > enable GENPD support for the core domain. Now NAND must be resumed using > runtime PM API in order to initialize the NAND power state. Add runtime PM > a

Re: [PATCH 5.4.y 0/2] 5.4.y missing upstream commits 7beb691f and 51f644b4, causing: WARNING in vkms_vblank_simulate

2021-08-17 Thread George Kennedy
Hello Thomas, I sent this backport request to sta...@vger.kernel.org a while ago including the maintainers, but mistakenly did not CC you. Sorry about that. Can you please review this backport request for 5.4.y? Greg is waiting to hear from the maintainers before accepting the backport reques

Re: [PATCH v2 61/63] powerpc: Split memset() to avoid multi-field overflow

2021-08-17 Thread Christophe Leroy
Le 18/08/2021 à 08:05, Kees Cook a écrit : In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Instead of writing across a field boundary with memset(), move the call to just the arra

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 09:22, Dmitry Osipenko wrote: > 18.08.2021 08:58, Viresh Kumar пишет: > > What about calling dev_pm_opp_set_rate(dev, clk_get_rate(dev)) here > > instead ? That will work, right ? The advantage is it works without > > any special routine to do so. > > It will work, but a dedicated hel

Re: [PATCH v2 59/63] can: flexcan: Use struct_group() to zero struct flexcan_regs regions

2021-08-17 Thread Marc Kleine-Budde
On 17.08.2021 23:05:29, Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field bounds checking for memset(), avoid intentionally writing across > neighboring fields. > > Add struct_group() to mark both regions of struct flexcan_regs that get > initialized

[PATCH v2 32/63] fortify: Add compile-time FORTIFY_SOURCE tests

2021-08-17 Thread Kees Cook
While the run-time testing of FORTIFY_SOURCE is already present in LKDTM, there is no testing of the expected compile-time detections. In preparation for correctly supporting FORTIFY_SOURCE under Clang, adding additional FORTIFY_SOURCE defenses, and making sure FORTIFY_SOURCE doesn't silently regre

[PATCH v2 21/63] net/mlx5e: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct vlan_ethhdr around members h_dest and h_source, so they can be referenced together

[PATCH v2 57/63] powerpc/signal32: Use struct_group() to zero spe regs

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add a struct_group() for the spe registers so that memset() can correctly reason about the size: In function 'fortify_memset_chk',

[PATCH v2 22/63] HID: cp2112: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct cp2112_string_report around members report, length, type, and string, so they can

[PATCH v2 45/63] ath11k: Use memset_startat() for clearing queue descriptors

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 33/63] lib: Introduce CONFIG_TEST_MEMCPY

2021-08-17 Thread Kees Cook
Before changing anything about memcpy(), memmove(), and memset(), add run-time tests to check basic behaviors for any regressions. Signed-off-by: Kees Cook --- lib/Kconfig.debug | 7 ++ lib/Makefile | 1 + lib/test_memcpy.c | 264 ++ 3 files c

[PATCH v2 58/63] ethtool: stats: Use struct_group() to clear all stats at once

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct stats_reply_data that should be initialized, which can now be done in a single memset() call

[PATCH v2 55/63] HID: roccat: Use struct_group() to zero kone_mouse_event

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct kone_mouse_event that should be initialized to zero. Cc: Stefan Achatz Cc: Jiri Kosina Cc

[PATCH v2 52/63] cm4000_cs: Use struct_group() to zero struct cm4000_dev region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct cm4000_dev that should be initialized to zero. Cc: Harald Welte Cc: Arnd Bergmann Cc: Gre

[PATCH v2 54/63] dm integrity: Use struct_group() to zero struct journal_sector

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct journal_sector that should be initialized to zero. Cc: Alasdair Kergon Cc: Mike Snitzer C

[PATCH v2 49/63] btrfs: Use memset_startat() to clear end of struct

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 08:58, Viresh Kumar пишет: > On 18-08-21, 08:21, Dmitry Osipenko wrote: >> Yes, GENPD will cache the perf state across suspend/resume and initially >> cached value is out of sync with h/w. >> >> Nothing else. But let me clarify it all again. > > Thanks for your explanation. > >> Initia

[PATCH v2 50/63] tracing: Use memset_startat() to zero struct trace_iterator

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() to avoid confusing memset() about writing beyond the target struct member. Cc: Steven Rostedt Cc: Ingo Molnar Si

[PATCH v2 25/63] compiler_types.h: Remove __compiletime_object_size()

2021-08-17 Thread Kees Cook
Since all compilers support __builtin_object_size(), and there is only one user of __compiletime_object_size, remove it to avoid the needless indirection. This lets Clang reason about check_copy_size() correctly. Link: https://github.com/ClangBuiltLinux/linux/issues/1179 Suggested-by: Nick Desauln

[PATCH v2 26/63] lib/string: Move helper functions out of string.c

2021-08-17 Thread Kees Cook
The core functions of string.c are those that may be implemented by per-architecture functions, or overloaded by FORTIFY_SOURCE. As a result, it needs to be built with __NO_FORTIFY. Without this, macros will collide with function declarations. This was accidentally working due to -ffreestanding (on

[PATCH v2 20/63] drm/mga/mga_ioc32: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct drm32_mga_init around members chipset, sgram, maccess, fb_cpp, front_offset, front

[PATCH v2 38/63] xfrm: Use memset_after() to clear padding

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Clear trailing padding bytes using the new helper so that memset() doesn't get confused about writing "past the end" of the last struct

[PATCH v2 43/63] net: qede: Use memset_startat() for counters

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 41/63] net: 802: Use memset_startat() to clear struct fields

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 15/63] intersil: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct hfa384x_tx_frame around members frame_control, duration_id, addr1, addr2, addr3, a

[PATCH v2 56/63] RDMA/mlx5: Use struct_group() to zero struct mlx5_ib_mr

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct mlx5_ib_mr that should be initialized to zero. Cc: Leon Romanovsky Cc: Doug Ledford Cc: J

[PATCH v2 17/63] bnx2x: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct nig_stats around members egress_mac_pkt0_lo, egress_mac_pkt0_hi, egress_mac_pkt1_l

[PATCH v2 51/63] drbd: Use struct_group() to zero algs

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add a struct_group() for the algs so that memset() can correctly reason about the size. Cc: Philipp Reisner Cc: Lars Ellenberg Cc: Je

[PATCH v2 16/63] cxgb4: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct fw_eth_tx_pkt_vm_wr around members ethmacdst, ethmacsrc, ethtype, and vlantci, so

[PATCH v2 27/63] fortify: Move remaining fortify helpers into fortify-string.h

2021-08-17 Thread Kees Cook
When commit a28a6e860c6c ("string.h: move fortified functions definitions in a dedicated header.") moved the fortify-specific code, some helpers were left behind. Moves the remaining fortify-specific helpers into fortify-string.h so they're together where they're used. This requires that any FORTIF

[PATCH v2 18/63] drm/amd/pm: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in structs: struct atom_smc_dpm_info_v4_5 struct atom_smc_dpm_info_v4_6

[PATCH v2 44/63] mac80211: Use memset_after() to clear tx status

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH v2 48/63] IB/mthca: Use memset_startat() for clearing mpt_entry

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 39/63] ipv6: Use memset_after() to zero rt6_info

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() to clear everything after the dst_entry member of struct rt6_info. Cc: "David S. Miller" Cc: Hideaki YOSHIFUJI Cc:

[PATCH v2 46/63] iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 40/63] netfilter: conntrack: Use memset_startat() to zero struct nf_conn

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() to avoid confusing memset() about writing beyond the target struct member. Cc: Pablo Neira Ayuso Cc: Jozsef Kadle

[PATCH v2 19/63] staging: wlan-ng: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct hfa384x_tx_frame around members frame_control, duration_id, address[1-4], and sequ

[PATCH v2 53/63] KVM: x86: Use struct_group() to zero decode cache

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct x86_emulate_ctxt that should be initialized to zero. Cc: Paolo Bonzini Cc: Sean Christophe

[PATCH v2 61/63] powerpc: Split memset() to avoid multi-field overflow

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Instead of writing across a field boundary with memset(), move the call to just the array, and an explicit zeroing of the prior field.

[PATCH v2 35/63] fortify: Detect struct member overflows in memmove() at compile-time

2021-08-17 Thread Kees Cook
As done for memcpy(), also update memmove() to use the same tightened compile-time checks under CONFIG_FORTIFY_SOURCE. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/misc.c | 3 ++- arch/x86/lib/memcpy_32.c | 1 + include/linux/fortify-string.h

[PATCH v2 08/63] bnxt_en: Use struct_group_attr() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() around members queue_id, min_bw, max_bw, tsa, pri_lvl, and bw_weight so they can be referenc

[PATCH v2 01/63] ipw2x00: Avoid field-overflowing memcpy()

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. libipw_read_qos_param_element() copies a struct libipw_info_element into a struct libipw_qos_information_elemen

[PATCH v2 62/63] fortify: Detect struct member overflows in memset() at compile-time

2021-08-17 Thread Kees Cook
As done for memcpy(), also update memset() to use the same tightened compile-time bounds checking under CONFIG_FORTIFY_SOURCE. Signed-off-by: Kees Cook --- include/linux/fortify-string.h| 54 --- .../write_overflow_field-memset.c | 5 ++ 2 files chang

[PATCH v2 03/63] rpmsg: glink: Replace strncpy() with strscpy_pad()

2021-08-17 Thread Kees Cook
The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad() (as it seems this case expects the NUL padding to fill the allocation following the flexible array). This additionally silences a warning seen when building under -Warray-bounds: ./inc

[PATCH v2 02/63] net/mlx5e: Avoid field-overflowing memcpy()

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use flexible arrays instead of zero-element arrays (which look like they are always overflowing) and split the

[PATCH v2 14/63] cxgb3: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct rss_hdr around members imm_data and intr_gen, so they can be referenced together.

[PATCH v2 30/63] fortify: Prepare to improve strnlen() and strlen() warnings

2021-08-17 Thread Kees Cook
In order to have strlen() use fortified strnlen() internally, swap their positions in the source. Doing this as part of later changes makes review difficult, so reoroder it here; no code changes. Cc: Francis Laniel Signed-off-by: Kees Cook --- include/linux/fortify-string.h | 22 +++

[PATCH v2 60/63] net/af_iucv: Use struct_group() to zero struct iucv_sock region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark the region of struct iucv_sock that gets initialized to zero. Avoid the future warning: In function 'fortify

[PATCH v2 10/63] libertas: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct txpd around members tx_dest_addr_high and tx_dest_addr_low so they can be referenc

[PATCH v2 07/63] skbuff: Switch structure bounds to struct_group()

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Replace the existing empty member position markers "headers_start" and "headers_end" with a struct_group(). Thi

[PATCH v2 04/63] pcmcia: ray_cs: Split memcpy() to avoid bounds check warning

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Split memcpy() for each address range to help memcpy() correctly reason about the bounds checking. Avoids the f

[PATCH v2 63/63] fortify: Work around Clang inlining bugs

2021-08-17 Thread Kees Cook
To enable FORTIFY_SOURCE support for Clang, the kernel must work around a pair of bugs, related to Clang's inlining. Change all the fortified APIs into macros with different inline names to bypass Clang's broken inline-of-a-builtin detection: https://bugs.llvm.org/show_bug.cgi?id=50322 Lift all m

[PATCH v2 00/63] Introduce strict memcpy() bounds checking

2021-08-17 Thread Kees Cook
Hi, This patch series (based on next-20210816) implements stricter (no struct member overflows) bounds checking for memcpy(), memmove(), and memset() under CONFIG_FORTIFY_SOURCE. To quote a later patch in the series: tl;dr: In order to eliminate a large class of common buffer overflow fla

[PATCH v2 34/63] fortify: Detect struct member overflows in memcpy() at compile-time

2021-08-17 Thread Kees Cook
memcpy() is dead; long live memcpy() tl;dr: In order to eliminate a large class of common buffer overflow flaws that continue to persist in the kernel, have memcpy() (under CONFIG_FORTIFY_SOURCE) perform bounds checking of the destination struct member when they have a known size. This would have

[PATCH v2 05/63] stddef: Introduce struct_group() helper macro

2021-08-17 Thread Kees Cook
Kernel code has a regular need to describe groups of members within a structure usually when they need to be copied or initialized separately from the rest of the surrounding structure. The generally accepted design pattern in C is to use a named sub-struct: struct foo { in

[PATCH v2 42/63] net: dccp: Use memset_startat() for TP zeroing

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 36/63] scsi: ibmvscsi: Avoid multi-field memset() overflow by aiming at srp

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Instead of writing beyond the end of evt_struct->iu.srp.cmd, target the upper union (evt_struct->iu.srp) instead, as that's what is bein

[PATCH v2 31/63] fortify: Allow strlen() and strnlen() to pass compile-time known lengths

2021-08-17 Thread Kees Cook
Under CONFIG_FORTIFY_SOURCE, it is possible for the compiler to perform strlen() and strnlen() at compile-time when the string size is known. This is required to support compile-time overflow checking in strlcpy(). Signed-off-by: Kees Cook --- include/linux/fortify-string.h | 47

[PATCH v2 23/63] media: omap3isp: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Wrap the target region in struct_group(). This additionally fixes a theoretical misalignment of the copy (since

[PATCH v2 47/63] intel_th: msu: Use memset_startat() for clearing hw header

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_startat() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting po

[PATCH v2 28/63] fortify: Explicitly disable Clang support

2021-08-17 Thread Kees Cook
Clang has never correctly compiled the FORTIFY_SOURCE defenses due to a couple bugs: Eliding inlines with matching __builtin_* names https://bugs.llvm.org/show_bug.cgi?id=50322 Incorrect __builtin_constant_p() of some globals https://bugs.llvm.org/show_bug.cgi?id=4

[PATCH v2 59/63] can: flexcan: Use struct_group() to zero struct flexcan_regs regions

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark both regions of struct flexcan_regs that get initialized to zero. Avoid the future warnings: In function 'fo

[PATCH v2 12/63] thermal: intel: int340x_thermal: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), avoid intentionally writing across neighboring fields. Use struct_group() in struct art around members weight, and ac[0-9]_max, so they can be referenced together. This will allow memcpy() an

[PATCH v2 11/63] libertas_tf: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field array bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct txpd around members tx_dest_addr_high and tx_dest_addr_low so they can be re

[PATCH v2 09/63] mwl8k: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct mwl8k_cmd_set_key around members key_material, tkip_tx_mic_key, and tkip_rx_mic_ke

[PATCH v2 37/63] string.h: Introduce memset_after() for wiping trailing members/padding

2021-08-17 Thread Kees Cook
A common idiom in kernel code is to wipe the contents of a structure after a given member. This is especially useful in places where there is trailing padding. These open-coded cases are usually difficult to read and very sensitive to struct layout changes. Introduce a new helper, memset_after() th

[PATCH v2 29/63] fortify: Fix dropped strcpy() compile-time write overflow check

2021-08-17 Thread Kees Cook
The implementation for intra-object overflow in str*-family functions accidentally dropped compile-time write overflow checking in strcpy(), leaving it entirely to run-time. Add back the intended check. Fixes: 6a39e62abbaf ("lib: string.h: detect intra-object overflow in fortified string function

[PATCH v2 13/63] iommu/amd: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct ivhd_entry around members ext and hidh, so they can be referenced together. This w

[PATCH v2 24/63] sata_fsl: Use struct_group() for memcpy() region

2021-08-17 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct command_desc around members acmd and fill, so they can be referenced together. Thi

[PATCH v2 06/63] cxl/core: Replace unions with struct_group()

2021-08-17 Thread Kees Cook
Use the newly introduced struct_group_typed() macro to clean up the declaration of struct cxl_regs. Cc: Alison Schofield Cc: Vishal Verma Cc: Ira Weiny Cc: Ben Widawsky Cc: linux-...@vger.kernel.org Suggested-by: Dan Williams Link: https://lore.kernel.org/lkml/1d9a2e6df2a9a35b2cdd50a9a68cac5

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 11:28, Viresh Kumar wrote: > On 18-08-21, 08:21, Dmitry Osipenko wrote: > > Yes, GENPD will cache the perf state across suspend/resume and initially > > cached value is out of sync with h/w. > > > > Nothing else. But let me clarify it all again. > > Thanks for your explanation. > >

Re: [RFC PATCH 06/17] drm/exynos: dsi: Handle exynos specifics via driver_data

2021-08-17 Thread Inki Dae
Hi Laurent, 21. 8. 13. 오후 9:16에 Laurent Pinchart 이(가) 쓴 글: > Hi Inki, > > On Fri, Aug 13, 2021 at 03:50:56PM +0900, Inki Dae wrote: >> 21. 7. 26. 오전 2:25에 Sam Ravnborg 이(가) 쓴 글: >>> On Sun, Jul 04, 2021 at 02:32:19PM +0530, Jagan Teki wrote: Exynos DSI driver is actually a Samsung MIPI DSIM

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 08:21, Dmitry Osipenko wrote: > Yes, GENPD will cache the perf state across suspend/resume and initially > cached value is out of sync with h/w. > > Nothing else. But let me clarify it all again. Thanks for your explanation. > Initially the performance state of all GENPDs is 0 for a

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 07:53, Viresh Kumar пишет: > On 18-08-21, 07:37, Dmitry Osipenko wrote: >> This will set voltage level without having an actively used hardware. >> Take a 3d driver for example, if you set the rate on probe and >> rpm-resume will never be called, then the voltage will be set high, >> whi

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 07:37, Dmitry Osipenko wrote: > This will set voltage level without having an actively used hardware. > Take a 3d driver for example, if you set the rate on probe and > rpm-resume will never be called, then the voltage will be set high, > while hardware is kept suspended if userspace w

Re: [RFC PATCH 1/5] dt-bindings: mediatek,dpi: Add mt8195 dpintf

2021-08-17 Thread CK Hu
Hi, Markus: On Mon, 2021-08-16 at 21:25 +0200, Markus Schneider-Pargmann wrote: > DP_INTF is similar to the actual dpi. They differ in some points > regarding registers and what needs to be set but the function blocks > itself are similar in design. > > Signed-off-by: Markus Schneider-Pargmann >

Re: [RFC PATCH 5/5] drm/mediatek: Add mt8195 DisplayPort driver

2021-08-17 Thread CK Hu
Hi, Markus: On Mon, 2021-08-16 at 21:25 +0200, Markus Schneider-Pargmann wrote: > This patch adds a DisplayPort driver for the Mediatek mt8195 SoC. > > It supports both functional units on the mt8195, the embedded > DisplayPort as well as the external DisplayPort units. It offers > hot-plug-detec

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 07:31, Viresh Kumar пишет: > On 18-08-21, 07:12, Dmitry Osipenko wrote: >> 18.08.2021 06:55, Viresh Kumar пишет: >>> On 17-08-21, 18:49, Dmitry Osipenko wrote: 17.08.2021 10:55, Viresh Kumar пишет: ... >> +int dev_pm_opp_sync(struct device *dev) >> +{ >> +st

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 07:30, Dmitry Osipenko wrote: > 18.08.2021 07:29, Dmitry Osipenko пишет: > >> The first resume initializes the OPP state on sync, all further syncs on > >> resume are no-ops. > >> > > > > Notice that we use GENPD here. GENPD core takes care of storing PD's > > performance state (volta

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 18-08-21, 07:12, Dmitry Osipenko wrote: > 18.08.2021 06:55, Viresh Kumar пишет: > > On 17-08-21, 18:49, Dmitry Osipenko wrote: > >> 17.08.2021 10:55, Viresh Kumar пишет: > >> ... > +int dev_pm_opp_sync(struct device *dev) > +{ > +struct opp_table *opp_table; > +

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 07:29, Dmitry Osipenko пишет: > 18.08.2021 07:12, Dmitry Osipenko пишет: >> 18.08.2021 06:55, Viresh Kumar пишет: >>> On 17-08-21, 18:49, Dmitry Osipenko wrote: 17.08.2021 10:55, Viresh Kumar пишет: ... >> +int dev_pm_opp_sync(struct device *dev) >> +{ >> +s

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 07:12, Dmitry Osipenko пишет: > 18.08.2021 06:55, Viresh Kumar пишет: >> On 17-08-21, 18:49, Dmitry Osipenko wrote: >>> 17.08.2021 10:55, Viresh Kumar пишет: >>> ... > +int dev_pm_opp_sync(struct device *dev) > +{ > + struct opp_table *opp_table; > + struct dev_pm_opp *op

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Dmitry Osipenko
18.08.2021 06:55, Viresh Kumar пишет: > On 17-08-21, 18:49, Dmitry Osipenko wrote: >> 17.08.2021 10:55, Viresh Kumar пишет: >> ... +int dev_pm_opp_sync(struct device *dev) +{ + struct opp_table *opp_table; + struct dev_pm_opp *opp; + int ret = 0; + + /* Device

Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper

2021-08-17 Thread Viresh Kumar
On 17-08-21, 18:49, Dmitry Osipenko wrote: > 17.08.2021 10:55, Viresh Kumar пишет: > ... > >> +int dev_pm_opp_sync(struct device *dev) > >> +{ > >> + struct opp_table *opp_table; > >> + struct dev_pm_opp *opp; > >> + int ret = 0; > >> + > >> + /* Device may not have OPP table */ > >> + opp_tab

Re: [Freedreno] [PATCH v2 7/7] drm/msm/dpu: remove struct dpu_encoder_irq and enum dpu_intr_idx

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: Drop the wrapping structures and the enum used to index those structures in dpu_kms. Instead of them use IRQ indices and callback functions directly. Signed-off-by: Dmitry Baryshkov Is this change really needed because I think the enum based appro

Re: [Freedreno] [PATCH v2 6/7] drm/msm/dpu: get rid of dpu_encoder_helper_(un)register_irq

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: Get rid of dpu_encoder_helper_register_irq/unregister_irq helpers, call dpu_core_register/unregister_callback directly, without surrounding them with helpers. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/di

Re: [Freedreno] [PATCH v2 5/7] drm/msm/dpu: remove extra wrappers around dpu_core_irq

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: Remove extra dpu_irq_* wrappers from dpu_kms.c, merge them directly into dpu_core_irq_* functions. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h | 12 - .../gpu/drm/msm/disp/

Re: [Freedreno] [PATCH v2 4/7] drm/msm/dpu: allow just single IRQ callback

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: DPU interrupts code allows multiple callbacks per interrut. In reality /interrupt none of the interrupts is shared between blocks (and will probably never be). Drop support for registering multiple callbacks per interrupt to simplify interrupt handl

Re: [Freedreno] [PATCH v2 3/7] drm/msm/dpu: merge struct dpu_irq into struct dpu_hw_intr

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: As dpu_core_irq was merged into dpu_hw_intr, merge data structures too, removing the need for a separate data structure. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 51 +--

Re: [Freedreno] [PATCH v2 2/7] drm/msm/dpu: don't clear IRQ register twice

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: We already clear the IRQ status register before processing IRQs, so do not clear the register again. Especially do not clear the IRQ status _after_ processing the IRQ as this way we can loose the event. Signed-off-by: Dmitry Baryshkov Reviewed-by: A

Re: [Freedreno] [PATCH v2 1/7] drm/msm/dpu: squash dpu_core_irq into dpu_hw_interrupts

2021-08-17 Thread abhinavk
On 2021-06-17 15:20, Dmitry Baryshkov wrote: With dpu_core_irq being the wrapper around dpu_hw_interrupts, there is little sense in having them separate. Squash them together to remove another layer of abstraction (hw_intr ops). Signed-off-by: Dmitry Baryshkov Overall, I think this is a reason

Re: [PATCH v8 09/34] dt-bindings: host1x: Document Memory Client resets of Host1x, GR2D and GR3D

2021-08-17 Thread Dmitry Osipenko
18.08.2021 05:04, Dmitry Osipenko пишет: > 18.08.2021 04:37, Dmitry Osipenko пишет: >> 18.08.2021 04:16, Rob Herring пишет: >>> On Tue, Aug 17, 2021 at 04:27:29AM +0300, Dmitry Osipenko wrote: Memory Client should be blocked before hardware reset is asserted in order to prevent memory cor

Re: [PATCH v8 09/34] dt-bindings: host1x: Document Memory Client resets of Host1x, GR2D and GR3D

2021-08-17 Thread Dmitry Osipenko
18.08.2021 04:37, Dmitry Osipenko пишет: > 18.08.2021 04:16, Rob Herring пишет: >> On Tue, Aug 17, 2021 at 04:27:29AM +0300, Dmitry Osipenko wrote: >>> Memory Client should be blocked before hardware reset is asserted in order >>> to prevent memory corruption and hanging of memory controller. >>> >

Re: [PATCH v2] drm/fourcc: introduce DRM_FOURCC_STANDALONE guard

2021-08-17 Thread James Park
On Fri, Feb 26, 2021 at 12:08 AM James Park wrote: > > On Thu, Feb 4, 2021 at 1:07 PM Emil Velikov wrote: > > > > Do send a patch, unless someone shouts against it, I'll be happy to > > push it and churn the whole copy to drm/mesa game. > > > > Thanks > > Emil > > Hi Emil, > > Were you still plan

Re: [PATCH v8 06/34] dt-bindings: clock: tegra-car: Document new tegra-clocks sub-node

2021-08-17 Thread Dmitry Osipenko
18.08.2021 04:15, Rob Herring пишет: >> + tegra-clocks: >> +description: child nodes are the output clocks from the CAR >> +type: object >> + >> +patternProperties: >> + "^[a-z]+[0-9]+$": >> +type: object >> +properties: >> + compatible: >> +al

Re: [PATCH v8 09/34] dt-bindings: host1x: Document Memory Client resets of Host1x, GR2D and GR3D

2021-08-17 Thread Dmitry Osipenko
18.08.2021 04:16, Rob Herring пишет: > On Tue, Aug 17, 2021 at 04:27:29AM +0300, Dmitry Osipenko wrote: >> Memory Client should be blocked before hardware reset is asserted in order >> to prevent memory corruption and hanging of memory controller. >> >> Document Memory Client resets of Host1x, GR2D

Re: [PATCH v8 24/34] media: dt: bindings: tegra-vde: Document OPP and power domain

2021-08-17 Thread Rob Herring
On Tue, 17 Aug 2021 04:27:44 +0300, Dmitry Osipenko wrote: > Document new OPP table and power domain properties of the video decoder > hardware. > > Signed-off-by: Dmitry Osipenko > --- > .../devicetree/bindings/media/nvidia,tegra-vde.yaml | 12 > 1 file changed, 12 insertions(+) >

Re: [PATCH v8 23/34] media: dt: bindings: tegra-vde: Convert to schema

2021-08-17 Thread Rob Herring
On Tue, 17 Aug 2021 04:27:43 +0300, Dmitry Osipenko wrote: > Convert NVIDIA Tegra video decoder binding to schema. > > Signed-off-by: Dmitry Osipenko > --- > .../bindings/media/nvidia,tegra-vde.txt | 64 --- > .../bindings/media/nvidia,tegra-vde.yaml | 107 ++

Re: [PATCH v8 09/34] dt-bindings: host1x: Document Memory Client resets of Host1x, GR2D and GR3D

2021-08-17 Thread Rob Herring
On Tue, Aug 17, 2021 at 04:27:29AM +0300, Dmitry Osipenko wrote: > Memory Client should be blocked before hardware reset is asserted in order > to prevent memory corruption and hanging of memory controller. > > Document Memory Client resets of Host1x, GR2D and GR3D hardware units. > > Signed-off-

  1   2   3   >