You are not logged in.

#1 2020-02-02 14:20:05

Webmaniac2
Member
Registered: 2009-12-24
Posts: 28

Why is magic sysrq disabled by default?

Hey everyone,

I've just found out that the magic Sysrq Key on Arch is disabled by default. What's the reason for this decision? Are there any security risks
by enabling it? It would be nice to hear some insights from the developers! smile

best regards
Webmaniac

Offline

#2 2020-02-02 17:30:53

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,429

Re: Why is magic sysrq disabled by default?

The devs typically don't lurk in the forums, so if you want a true dev to answer you'll have to post to the mailing list, However, isn't it set up the most "Arch" way possible: upstream only defines CONFIG_MAGIC_SYSRQ and sets it to 'y', which is kept as-is on Arch. Upstream does not define CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE, which I assume means it's set to 0x0 by default, which means the Arch value matches upstream. If you want to change its setting, because CONFIG_MAGIC_SYSRQ=y, you can use sysctl/systemd config to set CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE either temporarily or permanently at runtime.

Offline

#3 2020-02-02 17:50:35

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Why is magic sysrq disabled by default?

Webmaniac2 wrote:

Are there any security risks
by enabling it?

AFAIK: yes. For Desktop-Systems, this shouldn't be a thing, but there aren't only People running Desktops out there, so the feature is disabled by default. Feel free to enable it, it's really easy.

Last edited by Thorsten Reinbold (2020-02-02 17:51:25)

Offline

#4 2020-02-02 18:01:28

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,319
Website

Re: Why is magic sysrq disabled by default?

The upstream default for CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE is 0x1. Arch explicitly set it to 0x0 back when the 3.13 kernel was released (and this option was presumably added): https://git.archlinux.org/svntogit/pack … =a1bf3bc4d

I can't find an explanation behind this decision, but disabling sysrq was already an Arch decision, and one seemingly made for safety reasons (noted in https://bugs.archlinux.org/task/13769).


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2020-02-02 18:23:19

loqs
Member
Registered: 2014-03-06
Posts: 18,787

Re: Why is magic sysrq disabled by default?

The upstream default set by systemd in /usr/lib/sysctl.d/50-default.conf is kernel.sysrq = 16

Offline

#6 2020-02-02 18:23:37

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,185

Re: Why is magic sysrq disabled by default?

I guess it's because w/ encrypted devices, there're different concepts of "physical access" and the sysreq could get you a root shell on an unencrypted device (what however implies that you already have physical access while the device is decrypted)
Another situation could be where rebooting is prohibited (in the OS) and you can have physical access to the keyboard, but not the system itself (eg. a banking terminal or whatever) in which case likewise the sysreq will get you unlimited access.

For a desktop/server w/o encryption etc. it doesn't matter. The sysreq implies that you have physical access and in that case you own the system anyway.

Offline

#7 2020-02-04 01:36:02

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,429

Re: Why is magic sysrq disabled by default?

WorMzy wrote:

The upstream default for CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE is 0x1

I thought I was looking in the right place, but apparently not: where do you see it being set to 0x1? I checked https://git.archlinux.org/svntogit/pack … ages/linux, and it (at time of writing) says:

#
# Generic Kernel Debugging Instruments
#
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x0

Offline

#8 2020-02-04 04:50:40

loqs
Member
Registered: 2014-03-06
Posts: 18,787

Re: Why is magic sysrq disabled by default?

Offline

#9 2020-02-04 08:45:27

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,319
Website

Re: Why is magic sysrq disabled by default?

Sorry, forgot to include that in my post, thanks loqs.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB