2023-08-07 01:31:46

by Bagas Sanjaya

[permalink] [raw]
Subject: Fwd: CFI violation when reading amd_pstate/status

Hi,

I notice a bug report on Bugzilla [1]. Quoting from it:

> On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
>
> This is reproduceable with every read, I have only tried with amd_pstate=active
>
> With the following CFI and Clang configs, Clang 16.0.6
> CONFIG_CFI_CLANG=y
> CONFIG_CFI_PERMISSIVE=y
> CONFIG_LTO_CLANG=y
> CONFIG_LTO_CLANG_THIN=y
>
> Below is the full call trace, let me know if you need a trace with debug info.
>
> [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1
> [ 4947.849399] Hardware name: ASUS System Product Name/TUF GAMING B650M-PLUS WIFI, BIOS 1616 05/16/2023
> [ 4947.849400] RIP: 0010:dev_attr_show+0x24/0x60
> [ 4947.849401] Code: 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 41 56 53 4c 8b 5e 10 4d 85 db 74 34 49 89 f6 41 ba 22 4e ae 79 45 03 53 f1 74 02 <0f> 0b 41 ff d3 0f 1f 00 48 89 c3 48 3d 00 10 00 00 7c 19 49 8b 76
> [ 4947.849403] RSP: 0018:ffffb33a03d9fd10 EFLAGS: 00010203
> [ 4947.849404] RAX: ffff922f11509980 RBX: ffff9230e86f43c0 RCX: 0000000000000000
> [ 4947.849404] RDX: ffff922f1746b000 RSI: ffffffffaee25f10 RDI: ffff922f0005f800
> [ 4947.849405] RBP: ffff9230e86f43e8 R08: 0000000000001000 R09: ffff922f1746b000
> [ 4947.849405] R10: 0000000015e419ad R11: ffffffffadda9330 R12: ffffffffae8aa188
> [ 4947.849406] R13: ffff9233bbcb6fc0 R14: ffffffffaee25f10 R15: ffff922f1746b000
> [ 4947.849407] FS: 00007eff007b4740(0000) GS:ffff923657e80000(0000) knlGS:0000000000000000
> [ 4947.849407] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 4947.849408] CR2: 00007eff0099f000 CR3: 000000010a0a2000 CR4: 0000000000750ee0
> [ 4947.849409] PKRU: 55555554
> [ 4947.849409] Call Trace:
> [ 4947.849410] <TASK>
> [ 4947.849411] ? __warn+0xcf/0x1c0
> [ 4947.849414] ? dev_attr_show+0x24/0x60
> [ 4947.849415] ? report_cfi_failure+0x4e/0x60
> [ 4947.849417] ? handle_cfi_failure+0x14c/0x1d0
> [ 4947.849419] ? __cfi_show_status+0x10/0x10
> [ 4947.849420] ? handle_bug+0x4f/0x90
> [ 4947.849421] ? exc_invalid_op+0x1a/0x60
> [ 4947.849422] ? asm_exc_invalid_op+0x1a/0x20
> [ 4947.849424] ? __cfi_show_status+0x10/0x10
> [ 4947.849425] ? dev_attr_show+0x24/0x60
> [ 4947.849426] sysfs_kf_seq_show+0xa6/0x110
> [ 4947.849433] seq_read_iter+0x16c/0x4b0
> [ 4947.849436] vfs_read+0x272/0x2d0
> [ 4947.849438] ksys_read+0x72/0xe0
> [ 4947.849439] do_syscall_64+0x76/0xb0
> [ 4947.849440] ? do_user_addr_fault+0x252/0x650
> [ 4947.849442] ? exc_page_fault+0x7a/0x1b0
> [ 4947.849443] entry_SYSCALL_64_after_hwframe+0x72/0xdc
> [ 4947.849444] RIP: 0033:0x7eff008b2651
> [ 4947.849445] Code: b5 fe ff ff 48 8d 3d 66 42 0a 00 50 e8 68 1b 02 00 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d ad 0d 0e 00 00 74 13 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 57 c3 66 0f 1f 44 00 00 53 48 83 ec 20 48 89
> [ 4947.849446] RSP: 002b:00007ffecca23268 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
> [ 4947.849447] RAX: ffffffffffffffda RBX: 0000000000008000 RCX: 00007eff008b2651
> [ 4947.849447] RDX: 0000000000020000 RSI: 00007eff009a0000 RDI: 0000000000000003
> [ 4947.849448] RBP: 0000000000000003 R08: 00000000ffffffff R09: 0000000000000000
> [ 4947.849448] R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000020000
> [ 4947.849449] R13: 0000000000000000 R14: 00007eff009a0000 R15: 0000000000020000
> [ 4947.849450] </TASK>
> [ 4947.849450] ---[ end trace 0000000000000000 ]---

See Bugzilla for the full thread.

Thanks.

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=217765

--
An old man doll... just what I always wanted! - Clara


2023-08-07 06:49:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

On Mon, Aug 07, 2023 at 08:21:37AM +0200, Jannik Gl?ckert wrote:
> Hi Greg,
>
> our kernel uses the Fedora config and has a homeopathic patchset on
> top of upstream - see
> https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=6.4 except
> the 50** patches.
> Namely we don't touch cpufreq or pm.
>
> > Comm: cat Tainted: P
>
> I am not using any out of tree modules, the kernel switches to
> Tainted: P on the first CFI violation.

Ah, ok. Then work with the amd_pstate driver authors on this, odds are
one of the sysfs callbacks is incorrectly created which is quite easy to
do for stuff like this. CFI also gets confused at times when dealing
with sysfs attributes due to them being cast in all sorts of crazy ways.

good luck!

greg k-h

2023-08-07 07:14:19

by Jannik Glückert

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

Hi Greg,

our kernel uses the Fedora config and has a homeopathic patchset on
top of upstream - see
https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=6.4 except
the 50** patches.
Namely we don't touch cpufreq or pm.

> Comm: cat Tainted: P

I am not using any out of tree modules, the kernel switches to
Tainted: P on the first CFI violation.

Regards
Jannik

Am Mo., 7. Aug. 2023 um 08:03 Uhr schrieb Greg Kroah-Hartman
<[email protected]>:
>
> On Mon, Aug 07, 2023 at 06:55:49AM +0700, Bagas Sanjaya wrote:
> > Hi,
> >
> > I notice a bug report on Bugzilla [1]. Quoting from it:
> >
> > > On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> > > I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
> > >
> > > This is reproduceable with every read, I have only tried with amd_pstate=active
> > >
> > > With the following CFI and Clang configs, Clang 16.0.6
> > > CONFIG_CFI_CLANG=y
> > > CONFIG_CFI_PERMISSIVE=y
> > > CONFIG_LTO_CLANG=y
> > > CONFIG_LTO_CLANG_THIN=y
> > >
> > > Below is the full call trace, let me know if you need a trace with debug info.
> > >
> > > [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> > > [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> > > [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> > > [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> > > [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1
>
> Can't do much about this kernel, we don't know what's really in it,
> sorry.
>
> greg k-h

2023-08-07 07:53:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

On Mon, Aug 07, 2023 at 06:55:49AM +0700, Bagas Sanjaya wrote:
> Hi,
>
> I notice a bug report on Bugzilla [1]. Quoting from it:
>
> > On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> > I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
> >
> > This is reproduceable with every read, I have only tried with amd_pstate=active
> >
> > With the following CFI and Clang configs, Clang 16.0.6
> > CONFIG_CFI_CLANG=y
> > CONFIG_CFI_PERMISSIVE=y
> > CONFIG_LTO_CLANG=y
> > CONFIG_LTO_CLANG_THIN=y
> >
> > Below is the full call trace, let me know if you need a trace with debug info.
> >
> > [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> > [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> > [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> > [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> > [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1

Can't do much about this kernel, we don't know what's really in it,
sorry.

greg k-h

2023-08-07 17:47:15

by Nick Desaulniers

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

On Mon, Aug 7, 2023 at 9:15 AM Nick Desaulniers <[email protected]> wrote:
>
> On Sun, Aug 6, 2023 at 11:21 PM Jannik Glückert
> <[email protected]> wrote:
> >
> > Hi Greg,
> >
> > our kernel uses the Fedora config and has a homeopathic patchset on
> > top of upstream - see
> > https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=6.4 except
> > the 50** patches.
> > Namely we don't touch cpufreq or pm.
> >
> > > Comm: cat Tainted: P
> >
> > I am not using any out of tree modules, the kernel switches to
> > Tainted: P on the first CFI violation.
>
> Thanks for the report.
> Let's track this in
> https://github.com/ClangBuiltLinux/linux/issues/1901
> (You can use the MAINTAINERS file to see issue trackers via the `B:`
> symbol used by various parts of the tree).

Heh, while doing my morning email scrub, it looks like a patch has
already been sent (a few minutes ago):
https://lore.kernel.org/all/[email protected]/

>
> >
> > Regards
> > Jannik
> >
> > Am Mo., 7. Aug. 2023 um 08:03 Uhr schrieb Greg Kroah-Hartman
> > <[email protected]>:
> > >
> > > On Mon, Aug 07, 2023 at 06:55:49AM +0700, Bagas Sanjaya wrote:
> > > > Hi,
> > > >
> > > > I notice a bug report on Bugzilla [1]. Quoting from it:
> > > >
> > > > > On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> > > > > I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
> > > > >
> > > > > This is reproduceable with every read, I have only tried with amd_pstate=active
> > > > >
> > > > > With the following CFI and Clang configs, Clang 16.0.6
> > > > > CONFIG_CFI_CLANG=y
> > > > > CONFIG_CFI_PERMISSIVE=y
> > > > > CONFIG_LTO_CLANG=y
> > > > > CONFIG_LTO_CLANG_THIN=y
> > > > >
> > > > > Below is the full call trace, let me know if you need a trace with debug info.
> > > > >
> > > > > [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> > > > > [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> > > > > [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> > > > > [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> > > > > [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1
> > >
> > > Can't do much about this kernel, we don't know what's really in it,
> > > sorry.
> > >
> > > greg k-h
>
>
>
> --
> Thanks,
> ~Nick Desaulniers



--
Thanks,
~Nick Desaulniers

2023-08-07 17:52:05

by Nick Desaulniers

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

On Sun, Aug 6, 2023 at 11:21 PM Jannik Glückert
<[email protected]> wrote:
>
> Hi Greg,
>
> our kernel uses the Fedora config and has a homeopathic patchset on
> top of upstream - see
> https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=6.4 except
> the 50** patches.
> Namely we don't touch cpufreq or pm.

Can you tell us more about your distro? Is it public? Is it built with clang?

>
> > Comm: cat Tainted: P
>
> I am not using any out of tree modules, the kernel switches to
> Tainted: P on the first CFI violation.
>
> Regards
> Jannik
>
> Am Mo., 7. Aug. 2023 um 08:03 Uhr schrieb Greg Kroah-Hartman
> <[email protected]>:
> >
> > On Mon, Aug 07, 2023 at 06:55:49AM +0700, Bagas Sanjaya wrote:
> > > Hi,
> > >
> > > I notice a bug report on Bugzilla [1]. Quoting from it:
> > >
> > > > On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> > > > I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
> > > >
> > > > This is reproduceable with every read, I have only tried with amd_pstate=active
> > > >
> > > > With the following CFI and Clang configs, Clang 16.0.6
> > > > CONFIG_CFI_CLANG=y
> > > > CONFIG_CFI_PERMISSIVE=y
> > > > CONFIG_LTO_CLANG=y
> > > > CONFIG_LTO_CLANG_THIN=y
> > > >
> > > > Below is the full call trace, let me know if you need a trace with debug info.
> > > >
> > > > [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> > > > [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> > > > [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> > > > [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> > > > [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1
> >
> > Can't do much about this kernel, we don't know what's really in it,
> > sorry.
> >
> > greg k-h



--
Thanks,
~Nick Desaulniers

2023-08-07 18:58:21

by Jannik Glückert

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

> Can you tell us more about your distro? Is it public? Is it built with clang?

Hi Nick,

this is Gentoo Linux, one of the oldest source distributions. We're
also the basis for ChromeOS and various other niche distros.

Gentoo defaults to gcc and glibc, though we also support clang and
musl (and any combination thereof).
You can find our compatibility tracker here
https://bugs.gentoo.org/408963 . You can also find us on
irc.libera.chat in the #gentoo-llvm channel.

Best regards
Jannik

2023-08-07 19:41:04

by Nick Desaulniers

[permalink] [raw]
Subject: Re: Fwd: CFI violation when reading amd_pstate/status

On Sun, Aug 6, 2023 at 11:21 PM Jannik Glückert
<[email protected]> wrote:
>
> Hi Greg,
>
> our kernel uses the Fedora config and has a homeopathic patchset on
> top of upstream - see
> https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=6.4 except
> the 50** patches.
> Namely we don't touch cpufreq or pm.
>
> > Comm: cat Tainted: P
>
> I am not using any out of tree modules, the kernel switches to
> Tainted: P on the first CFI violation.

Thanks for the report.
Let's track this in
https://github.com/ClangBuiltLinux/linux/issues/1901
(You can use the MAINTAINERS file to see issue trackers via the `B:`
symbol used by various parts of the tree).

>
> Regards
> Jannik
>
> Am Mo., 7. Aug. 2023 um 08:03 Uhr schrieb Greg Kroah-Hartman
> <[email protected]>:
> >
> > On Mon, Aug 07, 2023 at 06:55:49AM +0700, Bagas Sanjaya wrote:
> > > Hi,
> > >
> > > I notice a bug report on Bugzilla [1]. Quoting from it:
> > >
> > > > On kernel 6.4.7, with amd_pstate=active, with a Ryzen 7700X
> > > > I get a Clang CFI violation when reading /sys/devices/system/cpu/amd_pstate/status
> > > >
> > > > This is reproduceable with every read, I have only tried with amd_pstate=active
> > > >
> > > > With the following CFI and Clang configs, Clang 16.0.6
> > > > CONFIG_CFI_CLANG=y
> > > > CONFIG_CFI_PERMISSIVE=y
> > > > CONFIG_LTO_CLANG=y
> > > > CONFIG_LTO_CLANG_THIN=y
> > > >
> > > > Below is the full call trace, let me know if you need a trace with debug info.
> > > >
> > > > [ 4947.849350] CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70; expected type: 0x8651b1de)
> > > > [ 4947.849358] WARNING: CPU: 2 PID: 16519 at dev_attr_show+0x24/0x60
> > > > [ 4947.849360] Modules linked in: binfmt_misc nf_conntrack_netbios_ns nf_conntrack_broadcast wireguard curve25519_x86_64 libcurve25519_generic ip6_udp_tunnel udp_tunnel snd_seq_dummy snd_hrtimer snd_seq rfcomm joydev uhid xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp nft_fib_inet nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_reject_inet nf_reject_ipv6 nf_reject_ipv4 nft_reject nft_ct nft_chain_nat bridge 8021q mrp garp stp llc nf_tables ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_raw iptable_security ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables bnep vfat fat amdgpu snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel mt7921e vfio_pci intel_rapl_msr mt7921_common intel_rapl_common mt76_connac_lib edac_mce_amd vfio_pci_core mt76 vfio_iommu_type1 vfio kvm_amd iommufd iommu_v2 snd_usb_audio
> > > > [ 4947.849379] snd_intel_dspcfg gpu_sched snd_intel_sdw_acpi mac80211 drm_suballoc_helper snd_usbmidi_lib i2c_algo_bit drm_ttm_helper snd_hda_codec btusb ttm btrtl libarc4 btmtk snd_hda_core snd_rawmidi kvm snd_seq_device drm_display_helper btintel snd_hwdep mc btbcm irqbypass cfg80211 cec snd_pcm asus_nb_wmi bluetooth eeepc_wmi snd_timer asus_wmi drm_kms_helper ledtrig_audio sparse_keymap snd gpio_amdpt platform_profile gpio_generic drm_buddy rfkill soundcore rapl i2c_piix4 wmi_bmof pcspkr k10temp lm92 nct6775_core hwmon_vid fuse loop dm_crypt crct10dif_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel nvme sp5100_tco ccp r8169 nvme_core nvme_common video wmi sunrpc
> > > > [ 4947.849398] CPU: 2 PID: 16519 Comm: cat Tainted: P 6.4.7-gentoo-dist-hardened #1
> >
> > Can't do much about this kernel, we don't know what's really in it,
> > sorry.
> >
> > greg k-h



--
Thanks,
~Nick Desaulniers